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.

here's another stumper.

I have a tag.php page. It works fine, unless you click a tag that is in a post associated with a custom post type. Then it doesn't work. Its like that tag, doesn't exist. But its just a tag that's used cross site.

I'm not too sure why? And the codex isn't helping much after a lot of searching.

anyone ever run into this issue? I'm stumped.

thanks.

Nadine

share|improve this question

1 Answer 1

up vote 6 down vote accepted

If this is related to your other question, what you've got is a custom taxonomy, so you need either a taxonomy-{taxonomy}.php template (in your case taxonomy-article_topics.php), or just a more general taxonomy.php template.

(also, go back and accept answers to your other questions here if they've been solved!)

UPDATE

sorry, misunderstood your question-

add this to your functions.php template file to show your custom post types on tag pages:

function wpse28145_add_custom_types( $query ) {
    if( is_tag() && $query->is_main_query() ) {

        // this gets all post types:
        $post_types = get_post_types();

        // alternately, you can add just specific post types using this line instead of the above:
        // $post_types = array( 'post', 'your_custom_type' );

        $query->set( 'post_type', $post_types );
    }
}
add_filter( 'pre_get_posts', 'wpse28145_add_custom_types' );
share|improve this answer
    
I already have a taxonomy.php template, it serves as an archive for the article_topics. But the tags I'm using are site-wide already existing tags. So that's why I am confused...because this for example: <?php single_tag_title( ); ?> ...works fine, it just won't display any posts. (ok, re: accept answers...sorry). –  Nadine Sep 10 '11 at 4:22
    
@Nadine - see edit above. –  Milo Sep 10 '11 at 5:14
    
Note that using this code results in no navigation on the tag page (WP 3.9.1). –  MiniRagnarok Jul 18 at 17:46
    
Here is a refinement of this answer that accounts for the navigation. Search for 'Designophobia'. The person underneath them also suggests a less intrusive addition. wordpress.org/support/topic/… –  MiniRagnarok Jul 18 at 18:00
    
@MiniRagnarok - just add a check for $query->is_main_query() to the above to exclude all queries except the main query. –  Milo Jul 18 at 18:46

protected by Community Apr 1 at 7:31

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.