WordPress.org

Ready to get started?Download WordPress

Forums

Custom post type and new wp query for category page (1 post)

  1. jumust
    Member
    Posted 2 years ago #

    Hi,
    I created a custom template for a category (and children) called cat_mycatname.php

    Here I want to query posts only from a custom post type and with a tag

    <?php
    // The Query
    $cat_id = get_cat_ID();
    $args=array(
      'cat' => $cat_id,
      'post_type' => 'videopagine',
      'tag' => 'space',
    );
    $the_query = new WP_Query( $args );
    while ( $the_query->have_posts() ) : $the_query->the_post();
    
    ?>

    It can't seem to filter my results as I normally would, it just displays all the entries in that custom post type (in both parent and children cat pages)
    What's wrong?

Topic Closed

This topic has been closed to new replies.

About this Topic