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 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 create 3 column or Row Latest Post Via WP?

Hi,

Below code useful for all this is very nice one in WordPress.
<div>
<h2>Latest News</h2>
<?php
//$args = array(‘orderby’ => ‘date’, ‘numberposts’ => 3, ‘category’ => 6, ‘order’=> ‘DESC’); //This Categories wise latest post display
$args = array(‘orderby’ => ‘date’, ‘numberposts’ => 3, ‘order’=> ‘DESC’); // This all post display
$postslist = get_posts( $args );
$i; //This is counting the iteam purpose using
foreach ($postslist as $post) :  setup_postdata($post);
$i++; // This is increasing howmany foreach going that is purpose using.
?>
<div>
<h2><a href=”<?php echo get_permalink($page->ID); ?>”><?php the_title(); ?></a></h2>
<?php //the_date(); ?>
<?php //echo get_the_post_thumbnail($page->ID, ‘thumbnail’);?>
<?php echo get_the_post_thumbnail($page->ID, ‘full’); ?>
<?php the_excerpt(); ?>
</div>
<?php endforeach; ?>
</div><!– Latest News Container End –>

How to reduce expert length in WP?

This is reduce all Expert length in your word press :
add_filter(‘excerpt_length’, ‘my_excerpt_length’);
function my_excerpt_length($length) {
return 22;
}

This is reduce your categorie wise Expert length in your word press :
I getting below code for reference this site : http://www.wprecipes.com/wordpress-tip-change-excerpt-length-depending-of-the-category
add_filter(‘excerpt_length’, ‘my_excerpt_length’);
function my_excerpt_length($length) {
if(in_category(14)) {
return 13;
} else {
return 60;
}
}

thanks for above categories wise code.

🙂

another one i finding… below site
http://themehybrid.com/support/topic/correct-method-to-reduce-length-of-teaser
I just copied and inform to all. Hi above site guy thanks for your code.
function excerpt($num) {
$limit = $num+1;
$excerpt = explode(‘ ‘, get_the_excerpt(), $limit);
array_pop($excerpt);
$excerpt = implode(” “,$excerpt).”…”;
echo $excerpt;
}

function content($num) {
$theContent = get_the_content();
$output = preg_replace(‘/]+./’,”, $theContent);
$limit = $num+1;
$content = explode(‘ ‘, $output, $limit);
array_pop($content);
$content = implode(” “,$content).”…”;
echo $content;
}
——————————————————————————————————-

function limit_content($max_char, $more_link_text = ‘Read More »’, $stripteaser = 0, $more_file = ”) {
if(is_numeric($max_char) &amp;&amp; $max_char &gt; 1) :
$max_char = (int)$max_char;
$title = get_the_title();
$title = apply_filters(‘the_title’, $title);
$title = strip_tags($title);
$title = strlen($title);
$max_char = $max_char – $title;
$content = get_the_excerpt($more_link_text, $stripteaser, $more_file);
$content = apply_filters(‘the_excerpt’, $content);
$content = str_replace(‘]]&gt;’, ‘]]&gt;’, $content);
$content = strip_tags($content);
$char = $content;
if((strlen($char) &gt; $max_char) &amp;&amp; ($espacio = strpos($char, ” “, $max_char))) :
$content = substr($content, 0, $espacio); $content = $content;
echo ”
<p>”;
echo $content; echo “…”;
if($more_link_text) :
echo ” <a title=”&quot;; the_title(); echo &quot;” href=”&quot;; the_permalink(); echo &quot;”>”.$more_link_text.”</a>”;
endif;
echo “</p>
“;
elseif(strlen($_GET[‘p’]) &gt; 0) :
echo ”
<p>”;
echo $content;
if($more_link_text) :
echo ” <a title=”&quot;; the_title(); echo &quot;” href=”&quot;; the_permalink(); echo &quot;”>”.__(‘Read More »’,’options’).”</a>”;
endif;
echo “</p>
“;
else :
echo ”
<p>”;
echo $content;
if($more_link_text) :
echo ” <a title=”&quot;; the_title(); echo &quot;” href=”&quot;; the_permalink(); echo &quot;”>”.__(‘Read More »’,’options’).”</a>”;
endif;
echo “</p>
“;
endif;
endif;
}

thanks 🙂
http://themehybrid.com/support/topic/correct-method-to-reduce-length-of-teaser

How to Display Post in Categories Wise in WP?

<div>LATEST ARTICLES</div>
<?php
$args = array(‘orderby’ => ‘date’, ‘numberposts’ => 3, ‘category’ => 6, ‘order’=> ‘DESC’);
$postslist = get_posts( $args );
foreach ($postslist as $post) :  setup_postdata($post); ?>
<div>
<?php //the_date(); ?>
<div>
<?php //echo get_the_post_thumbnail($page->ID, ‘thumbnail’);
echo get_the_post_thumbnail($page->ID, ‘full’);
?>
</div>
<h3><a href=”<?php echo get_permalink($page->ID); ?>”><?php the_title(); ?></a></h3>

<?php the_excerpt(); ?>
</div>
<?php endforeach; ?>
<div></div>

<?php
// All Categorie Lagest Post Code
$the_query = new WP_Query( ‘cat=6&posts_per_page=10&offset=3’ );
// The Loop
while ( $the_query->have_posts() ) : $the_query->the_post();
?>
<div>
<?php //the_date(); ?>
<div>
<?php //echo get_the_post_thumbnail($page->ID, ‘thumbnail’);
echo get_the_post_thumbnail($page->ID, ‘full’);
?>
</div>
<h3><a href=”<?php echo get_permalink($page->ID); ?>”><?php the_title(); ?></a></h3>
<?php the_excerpt(); ?>
</div>
<?php
endwhile;

// Reset Post Data
wp_reset_postdata();
?>
<div></div>
<?php
// Get Categorie Slug Name
function get_cat_slug($cat_id) {
$cat_id = (int) $cat_id;
$category = &get_category($cat_id);
return $category->slug;
}
?>
<?php
// Get the categories
$category = get_the_category();

// Get the 3 Latest Article
$string = get_category_link( $category[0]->cat_ID );
//        echo $string;
?>
<div><a href=”http://www.anotherway.org/category/<?php echo get_cat_slug(6); ?>”>View All Save Your Health</a></div>

How to get the different categories Latest Article in one Page?

<div>LATEST ARTICLES</div>
<?php
$args = array( ‘orderby’ => ‘date’, ‘numberposts’ => 3, ‘order’=> ‘DESC’ );
$postslist = get_posts( $args );
foreach ($postslist as $post) :  setup_postdata($post); ?>
<div>
<?php //the_date(); ?>
<div>
<?php //echo get_the_post_thumbnail($page->ID, ‘thumbnail’);
echo get_the_post_thumbnail($page->ID, ‘full’);
?>
</div>
<h3><a href=”<?php echo get_permalink($page->ID); ?>”><?php the_title(); ?></a></h3>

<?php
// Get the categories
$category = get_the_category();

// Get the 3 Latest Article
$string = get_category_link( $category[0]->cat_ID );
?>
<h4><a href=”<?php echo str_replace(‘category/’, ”, $string ); ?>”><?php echo $category[0]->cat_name; ?></a></h4>
<?php the_excerpt(); ?>
</div>
<?php endforeach; ?>

How to View Current Page Sub Page only?

Hi, Below code is very nice,

<?php

$args = array(
‘numberposts’ => -1,
‘post_parent’ => $post->ID,
‘post_type’ => ‘page’,
‘post_status’ => ‘publish’,
‘orderby’ => ‘menu_order,title’,
‘order’ => ‘ASC’
);
$my_pagelist = &get_children($args);

if ($my_pagelist) {
foreach($my_pagelist as $my_child) {
$my_child_slug = $my_slug . ‘/’. $my_child->post_name.’/’;
$my_content = apply_filters(‘the_content’,$my_child->post_content);
$my_content = str_replace(‘]]>’, ‘]]>’, $my_content);
echo $my_content;
}
}
?>

This is reference site :
http://codex.wordpress.org/Function_Reference/wp_list_pages
http://wordpress.org/support/topic/display-subpage-content-on-parent-page
🙂

How Create Categorie Resent Post?

Display 5 latest posts in each category in WordPress


http://blogsessive.com/blogging-tools/latest-posts-by-category-archive/

Display 10 recent post titles on homepage

http://codex.wordpress.org/Function_Reference/in_category
<strong>http://codex.wordpress.org/Function_Reference/get_the_category</strong>
<div>LATEST ARTICLES</div>
$args = array(‘orderby’ => ‘name’, ‘numberposts’ =>3, ‘category’ => 3, ‘order’=> ‘ASC’, ‘orderby’ => ‘title’ );
$postslist = get_posts( $args );
foreach ($postslist as $post) :  setup_postdata($post); ?>
<div>
<div>ID, ‘thumbnail’);
echo get_the_post_thumbnail($page->ID, ‘full’);
?></div>
$category = get_the_category();

$category_id = get_cat_ID(‘3′);
// Get the URL of this category
$category_link = get_category_link($category_id);
//echo $category[3]->cat_name; ?>
<h4>cat_name.'”>’.$category[3]->cat_name.”; ?></h4>
</div>
that’s all :)

© 2020 Spirituality