Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Symptom: The following code will only work if I include the post type. Is this a correct behavior? Note:The data being called is a Custom Post Type.

<?php
$term=get_term_by( 'slug', get_query_var('term'), get_query_var('taxonomy')); // Capture the slug and hence get the taxonomy 
$parent=get_term($term->parent, get_query_var('taxonomy'));
$the_tax=get_taxonomy($term->taxonomy);
$sectionargs=array(
                'post_type'=> 'bookpage',  
                'meta_key' => 'Sort Number',
                'orderby'  => 'meta_value',
                'order'    => 'ASC'


                );
query_posts($sectionargs);?>
<ul>
<?php if (have_posts()): while (have_posts()): the_post();?>
<li><a href="<?php the_permalink(); ?>" ><?php the_title(); ?></a></li>
<?php endwhile;?>
</ul>

    <?php else: ?>
<p><?php _e('Sorry, no posts matched your criteria.');?></p>
<?php endif; ?>

The template is called with a url of the form /taxonomy/term.

I'm assuming therefore that any type of post assigned to the term in question should be found by the URL. However, if I omit the 'post type' then nothing is found suggesting perhaps that either the code needs to have the post type defined or it defaults to post_type=post. As far as I can tell the standard category archive template doesn't specify the post type.

Does anyone know if the post type should be required?

Thanks

share|improve this question
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.