Viewing 9 replies - 1 through 9 (of 9 total)
  • Your tag.php is not a search results page. It’s a tag archive page of all posts tagged a specific way.

    Your search results are search.php.

    It could either be a pre_get_posts filter or just some missing tag inside of tag.php.

    It’s hard to tell.

    Thread Starter designerdb

    (@designerdb)

    I understand that is not a search page, I posted that page as an example of how archives typically default on my page.

    I am using this template:
    https://github.com/WordPress/WordPress/blob/master/wp-content/themes/twentyfourteen/tag.php

    Do you see anything missing?

    Your using a child theme of twenty fourteen? If not….that template is specific to TwentyFourteen and would explain why it doesn’t work properly.

    does the same problem occur if you temporarily switch to Twenty Fifteen which also does not have a tag.php?

    does the problem continue if you temporarily deactivate all plugins?

    generally, if there is no tag.php in a theme, either archive.php or index.php would be used –

    most likely, the ‘not found’ has other reasons.

    every time a user clicked on a tag

    can you post a link to a post or page, where any tag link shows?

    or add a tag cloud widget to the sidebar?

    Thread Starter designerdb

    (@designerdb)

    Here is a page with tags/a tag cloud:

    http://www.digitalbolex.com/videos

    In digging deeper, I see this template is based on twentyeleven and not necessarily updated (that presents its own problems…). Twentyeleven does have a tag.php, so I replaced it with the twentyeleven version, but I am still stuck with “nothing found”

    I know the tag page is being read as I changed the default “nothing found” text and that reflects on the site.

    Twenty Eleven does have a tag.php – but that should make no difference.

    is your theme using any ‘pre_get_posts’ action (in functions.php?) to filter posts?

    are any of the posts actually ‘tag’ged with any of those tags?

    if so, can you give an example of a post and its tag(s)?

    Thread Starter designerdb

    (@designerdb)

    Quickly:
    – all of the posts are actually tagged. Oddly, tags WORKED prior to my last WP upgrade.
    http://www.digitalbolex.com/videos/unexpected-farewell/ is tagged short film, festival selection, slamdance 2015, watch online

    You are right on the money with the pre_get_posts causing the issue… looks like my webmaster left a reminder to fix the issue, but never actually fixed it! Found this nugget in my functions:

    //Custom Post Types Category/Tag Fix THIS IS CAUSING CAT/TAG ARCHIVE PAGE BUG
    add_filter(‘pre_get_posts’, ‘query_post_type’);
    function query_post_type($query) {
    if(is_category() || is_tag() || $query->is_search) {
    $post_type = get_query_var(‘post_type’);
    if($post_type)
    $post_type = $post_type;
    else
    $post_type = array(‘post’,’videos’, ‘galleries’, ‘products’, ‘nav_menu_item’); // add your custom post type(s). Keep nav_menu_items or menus will break on cat/tag pages
    $query->set(‘post_type’,$post_type);
    return $query;
    }
    }

    Thread Starter designerdb

    (@designerdb)

    Looks like it has to do with a “bug” in WordPress not showing tag archives of custom post types. I confirmed this by adding the tag “short film” to a regular post type post, and it appeared in the tag archive. You can see that tagging a normal post works: http://www.digitalbolex.com/tag/short-film/

    Most fixes recommend adding this to the functions.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');

    however adding that into my functions.php in place of the previous code doesn’t seem to fix the tag issue (although it does fix the incorrect display of the header/footer!)

    Thread Starter designerdb

    (@designerdb)

    This modified version of the code seems to work: https://core.trac.wordpress.org/ticket/19471#comment:9

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Tag.php … what am I doing wrong?’ is closed to new replies.