I need to echo category link of posts, so here is my query:
<?php
$args=array(
'cat' => 3,
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => 3,
'caller_get_posts'=> 1
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post(); ?>
....SOME HTML....
<?php
endwhile;
}
wp_reset_query();
?>
And on the bottom I need button “Show all posts” and it should redirect to subcategory list of post.
Just use WordPress’ function
the_category
. The second parametersingle
ensures that only child categories are shown. You can find more details about it in the documentation.It should work, if you use the code below in your while loop.
I hope this helps.