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 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 view in Catgory Name wise Recent Post view in WP?

You can add below code where you want in your php file inside :
<?php query_posts(‘category_name=pre-work-out&showposts=10’); ?>
<?php while (have_posts()) : the_post(); ?>
<h3><a href=”<?php echo get_permalink($page->ID); ?>”><?php the_title(); ?></a></h3>
<?php the_excerpt(); ?>
<?php endwhile;?>

This is show what you like in your recent post from your specific category wise. What you like change you “query_post” inside.

How to change expert more link label in WP?

// This link in excerpts more
function new_excerpt_more($more) {
global $post;
return ‘<a href=”‘. get_permalink($post->ID) . ‘”>Read More</a>’;
}
add_filter(‘excerpt_more’, ‘new_excerpt_more’);

Add above code in your functions.php.(This is file contain in your theme inside.)

What label you need, change the return href inside.

How to Change the Expert Length in WP?

Just add below code in functions.php inside,

add_filter(‘excerpt_length’, ‘my_excerpt_length’);
function my_excerpt_length($length) {
return 25;
}

And change the return value “25” to “Your Value”.

How to Show Full Text without continue reading Option in WP?

This is remove two Way :

1. Go to function.php search the twentyten_excerpt_length.
There you change below code
//return 40;
return 3000; –> Change here what extra numbers you need.

2. Second option –> Go loop.php
Find the_content
Then you remove or hide the condition part
ex :




You Place Below Code :


‘ ) ); ?>

that’s all 🙂 now this working well.

How to Get Custome Page Id view in Query?

<?php
// All Categorie Lagest Post Code
$the_query = new WP_Query( ‘page_id=14’ );
// 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>
<h2><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();
?>

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; ?>

© 2020 Spirituality