WordPress.org

Forums

[resolved] Tag.php and multiple custom post types (3 posts)

  1. Jeffrey van Rossum
    Member
    Posted 2 years ago #

    Hello everyone,

    I'm trying to make a tag.php to get all posts with a certain tag displayed. When I do this for one custom post type it works, see code:

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts($query_string .'&posts_per_page=10&post_type=games&paged=' . $paged); ?>

    However, when I add another one (see code below), there's no output! What is it I'm doing wrong?

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts($query_string .'&posts_per_page=10&post_type=games,projects&paged=' . $paged); ?>

    Hoping for help!

  2. macmeister
    Member
    Posted 2 years ago #

    Did you figure this out?
    I did have a version of this working in Genesis, however now I'm getting 404 errors on subsequent pages with the below in tag.php:

    <?php
    add_action('genesis_before_loop', 'child_before_tag_loop');
    function child_before_tag_loop () {
        global $query_string;
        $args = wp_parse_args($query_string, array( 'post_type' => array( 'post','abstracts','best-practices' ) ));
        query_posts( $args );
    }
    
    genesis();
  3. Jeffrey van Rossum
    Member
    Posted 2 years ago #

    Macmeister,

    When I putt the post types in an array it works. Hope you found a solution as well!

Topic Closed

This topic has been closed to new replies.

About this Topic