I am using wp_get_archive() in category.php.
If I am on page of category=2 it should show my archives of only that category. However it is for all the categories. Following is the code for my category.php as well as archive.php
<?php get_header(); ?>
<?php
$args =array(
'posts_per_page' =>1,
);
$loop = new WP_Query( $args );
if($loop->have_posts()):while ( $loop->have_posts() ): $loop->the_post();
the_content();
endwhile;
endif;
?>
<?php wp_get_archives( array( 'type' => 'daily') ); ?>
First part that is to show archive of specific category was solved by this code thanks to Pieter Goosen - answer given by him on How do I change the sql query for wp_get_archive()
But now problem is that if i go to that archive from the category page, i need to also show only posts from that category only.
Aucun commentaire:
Enregistrer un commentaire