• Resolved nadine00

    (@nadine00)


    Hi,

    I have a tag.php template, and currently it does not work when you click a tag with an article that is associated with a custom post type. I’m really confused, because its a site-wide tag….there’s no upfront reason it shouldn’t work.

    But the tag.php template just displays no article.

    The funny thing is that this: <?php single_tag_title( ); ?> …works fine.

    Do I have to “get the current tag” and pass that into a custom query or something? Do I have to use an archive template instead? Am I just missing something really obvious that I can’t find in the codex?

    I’m really new to custom post templates and so far, easy to set up: confusing to retrieve stuff from.

    So…help please? 🙁

    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter nadine00

    (@nadine00)

    Anyone?

    Thread Starter nadine00

    (@nadine00)

    Anyone?

    Basically what’s going on is this:

    I go to Articles. Articles is a custom post type. In this custom post type I have allowed the user to use all the existing tags on the site.

    I click on a tag in a post that is posted in “Articles” it uses the tag.php template, but won’t show posts with that tag. It will however show the tag title. So I don’t really know what’s going on.

    Wrong template to be using maybe?

    Thread Starter nadine00

    (@nadine00)

    So apparently, this is a bug: http://core.trac.wordpress.org/ticket/14589

    And this, which I found over at stackexchange is a good fix.

    <?php function post_type_tags_fix($request) {
        if ( isset($request['tag']) && !isset($request['post_type']) )
        $request['post_type'] = 'any';
        return $request;
    }
    add_filter('request', 'post_type_tags_fix');?>

    WP’s support for custom post-types is as varied and disorganized as its code. I noticed that posts show up in category and tag lists if you set the “has_archive” argument to true when you register your custom post-types via WP’s register_post_type() function: http://codex.wordpress.org/Function_Reference/register_post_type

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘tag.php acting weird with custom post types’ is closed to new replies.