How to Custome Wp Page Reading Query getting?

Below code for sameple custome page reading query.
Post Thumbnail URL Finding :

<?php //$mini_tennis_rewards_thumb = get_the_post_thumbnail($mini_tennis_rewards_data->ID, array(63,63));
$mini_tennis_rewards_thumb_src = wp_get_attachment_image_src( get_post_thumbnail_id( $mini_tennis_rewards_data->ID ), “thumbnail” );
?>

<a href=”<?php echo get_permalink($mini_tennis_rewards_data->ID); ?>”><img src=”<?php echo $mini_tennis_rewards_thumb_src[0]; ?>” /><span><?php echo $mini_tennis_rewards_data->post_title; ?></span></a>

<?php
$page_name = array(134,4778,4780,4782,4784,4786);

$privateCoaching_data = get_page($page_name[0]);
$proVideos_data = get_page($page_name[1]);
$calendar_data = get_page($page_name[2]);
$tipsOfTheWeek_data = get_page($page_name[3]);
$juniorPathway_data = get_page($page_name[4]);
$adultPathway_data = get_page($page_name[5]);
?>
<h1><a href=”<?php echo get_permalink($privateCoaching_data->ID); ?>”>Private Lessons</a></h1>

<img src=”<?php bloginfo( ‘stylesheet_directory’ ); ?>/images/privateLessons.jpg” />
<a href=”<?php echo get_permalink($privateCoaching_data->ID); ?>”><img src=”<?php bloginfo( ‘stylesheet_directory’ ); ?>/images/read-more.jpg” border=”0″ /></a>
<?php
//$privateCoaching_data_content = apply_filters(‘the_excerpt’, $privateCoaching_data->post_excerpt); // Get Content and retain WordPress filters such as paragraph tags. Origin from: http://wordpress.org/support/topic/get_pagepost-and-no-paragraphs-problem
//echo $privateCoaching_data_content;
echo $privateCoaching_data->post_excerpt;
?>

<!– Below line showes the post image –>

<?php echo get_the_post_thumbnail($mini_tennis_rewards_data->ID, ‘full’); ?>

This is line shows only for Image URL :

$thumbnail_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), "size" );

this is useful for custom post reader or page reader purpose.

How to Get Particular Category Title in you WP?

You Just Write Below Code for you Category Title purpose.

<?php
$cat_id = ’11’;
echo get_cat_name( $cat_id );
?>

this is showing the category title in your particular post category title.

How to Get Custome Filed in Query String Via in WP?

You Just write below code, your query loop inside :

<?php echo get_post_meta($post->ID, “field_name”, true); ?>

Before you add Custome field name and set Field Name Value also in post.

that is all.

How to Select Radio Button in javascript Via?

Hi Below code radio button selection sample script.
<script language=”javascript” type=”text/javascript”>
// For Radion Button Selected option

document.getElementById(‘sample’).checked = true;
if(document.getElementById(‘sample’).checked == true){
document.getElementById(‘sample’).style.display = ‘block’;
document.getElementById(‘sample’).disabled = false;
document.getElementById(‘sample’).disabled = false;
document.getElementById(‘sample’).disabled = false;
document.getElementById(‘sample’).disabled = false;
document.getElementById(‘sample’).disabled = false;
}
</script>

the above code is useful for yours more place. Enjoy its for very useful sometime in dynamic javascript section also. This is one of the small Javascript Via Radio Button Selection Sample.

How to Select Option Value in javascript Via?

Hi Below Code useful for yours Enjoy.
<script language=”javascript” type=”text/javascript”>
// For Option Value Selected in javascript Via

var myselect=document.getElementById(“myList”)
for (var i=0; i<myselect.options.length; i++){
myselect.options[i].selected=false;
//alert(“Selected Option’s index: “+i);
/* if (myselect.options[i].selected==true){
alert(“Selected Option’s index: “+i)
break
}*/
}
myselect.options[1].selected=true;
</script>

this is one of my method in javascript via options selection.

How to View Single Product URL Product ID via in Magento?

Hi below code for single product url. When you pass the query string in your url. You can use below code for single product url. Or you can put product id also here working fine.
<?php
$_productCollection=$this->getLoadedProductCollection();
$_helper = $this->helper(‘catalog/output’);

//Jai Write Below Code for Product id via getting Product URL Start

//redirect to old Product
if(isset($_GET[‘product_id’])){
$product_id = $_GET[‘product_id’];

$cProduct = Mage::getModel(“catalog/product”);
$cProduct->load($product_id);
//echo $cProduct->getImageUrl().”<br />”;
$currentProductURL = $cProduct->getProductUrl();
//echo $currentProductURL.”<br />”;

echo “<script type=’text/javascript’ language=’javascript’>window. location='”.$currentProductURL.”‘;</script>”;

}
//Jai Write Below Code for Product id via getting Product URL Start
?>

I have small knowledge in magento. So, I more then 3 hours spent for this code getting. If anyone find this post. This is useful for you.

thanks.

How to javascript hide and show option in via checkbox ?

You just put below code in your template style :

// Checked for Display Div Start
function fnchecked(blnchecked){
if(blnchecked){
document.getElementById(“webAddress”).style.display = “block”;
document.getElementById(“wwebAddress”).style.display = “block”;
document.getElementById(“wwebAddress”).style.height = “20px”;
//document.getElementById(“customers_wwebaddress”).value = “”;
}
else{
document.getElementById(“webAddress”).style.display = “none”;
document.getElementById(“wwebAddress”).value = “”;
document.getElementById(“wwebAddress”).style.display = “none”;
document.getElementById(“wwebAddress”).style.height = “0.1em”;
}
}

Finally call that function below textbox inside :

<input type=”text” onclick=”fnchecked(this.checked);” />

How to view Page Expert only in WP?

Hi People this is used for wp page excerpt only view.
<?php
$page_name = array(134,4754,4750); // 123 should be replaced with a specific Page’s id from your site, which you can find by mousing over the link to edit that Page on the Manage Pages admin page. The id will be embedded in the query string of the URL, e.g. page.php?action=edit&post=123.

$content_data1 = get_page( $page_name[0] );
$content_data2 = get_page( $page_name[1] );
$content_data3 = get_page( $page_name[2] ); // You must pass in a variable to the get_page function. If you pass in a value (e.g. get_page ( 123 ); ), WordPress will generate an error.

//Content Expert only view
echo $content_data1->post_excerpt;
?>

It is worked for me. Try your side.

<?php
$page_name = array(134,4754,4750); // 123 should be replaced with a specific Page’s id from your site, which you can find by mousing over the link to edit that Page on the Manage Pages admin page. The id will be embedded in the query string of the URL, e.g. page.php?action=edit&post=123.

$privateCoaching_data = get_page( $page_name[0] );
$facebook_data = get_page( $page_name[1] );
$newsletter_data = get_page( $page_name[2] ); // You must pass in a variable to the get_page function. If you pass in a value (e.g. get_page ( 123 ); ), WordPress will generate an error.
?>

How to avoid li bottom extra space in IE7?

You Just Avoid Space for li.

This is rank for IE 7 :
<ul>
<li>First</li>
<li>Second</li>
</ul>


You can use this code solve your problem :
<ul>
 <li>First</li><!--
--><li>Second</li><!--
--><li>Three</li>
</ul>

(OR)
<ul>
<li>First</li
><li>Second</li
><li>Three</li>
</ul>

(OR)
<ul><li>First</li><li>Second</li><li>Three</li></ul>

This is solved unwanted bottom space.

How to View Magneto SKU Number in Cart & Page View?

1. You Want cart page to view the SKU number :
You can use below code in your : app/design/frontend/youtheme/yourtheme/template/checkout/cart.phtml
<?php echo $this->__(‘SKU Number’) ?>

And add item section this : app/design/frontend/youtheme/yourtheme/template/checkout/cart/item/default.phtml
<?php echo $_item->getSku() ?>

2. You want to view the Page View :

app/design/frontend/youtheme/yourtheme/template/catalog/product/view.phtml
<!– Write SKU –>
<?php echo $this->__(‘SKU Number :’); ?> <?php
$sku = Mage::getModel(‘catalog/product’)->load($_product->getId())->getSku();
echo $sku; ?>
<!– Sku End –>

its is working for my side.

© 2020 Spirituality