i want to get archives of multipal custom post types can u help me guys here is my code which is not working
<?php $args = array(
'type' => 'yearly',
'limit' => '',
'format' => 'custom ',
'before' => '',
'after' => '',
'show_post_count' => false,
'echo' => 1,
'order' => 'DESC',
'post_type' => array('news','update')
);
wp_get_archives( $args );
Try This:
<?php
$args = array(
'post_type' => array('news','update'),
'post_status' => 'archive',
'type' => 'monthly',
'echo' => 0,
'order' => 'DESC'
);
$query = new WP_Query( $args );
// Check that we have query results.
if ( $query->have_posts() ) {
// Start looping over the query results.
while ( $query->have_posts() ) {
$query->the_post();
?>
<article id="post-<?php the_ID(); ?>" >
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<?php post_thumbnail( 'thumbnail' );?>
</a>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<?php the_title(); ?>
</a>
<?php the_excerpt(); ?>
</article>
<?php
}
}
// Restore original post data.
wp_reset_postdata();