Monday, 26 August 2013

Custom post type archive page for multiple post types

Custom post type archive page for multiple post types

Hi I am working on a archive page which I can use for multiple custom post
types. I need to make a variable in the $args array which can change to
the post_type name on the basis of <?php post_type_archive_title(); ?>
So something like this:
<?php
$post_type = post_type_archive_title();
$args = array(
'post_type' => $post_type,
'orderby' => 'title',
'order' => 'ASC',
'caller_get_posts' => 1,
'posts_per_page' => 20,
);
query_posts($args); ?>
But this doesn't work. Does anyone know how I can fix this?

No comments:

Post a Comment