Support » Themes and Templates » News posts taking on random tags

  • I’m using <?php the_tags('<p>Tags: ', ', ', '</p>'); ?> to display related tags on each page.

    I’ve tried other variations of PHP and the tags are still being generated incorrectly for news posts. Basically, it’s choosing a different post (from a different category) and is displaying that post’s tags for every news post instead of displaying the tags associated with each post.

    For example, I just made a new post under the category of “news”. No matter what I change the tags to, it keeps displaying “bird, disk” on the page. I found another post that I made earlier that has these tags, and changing these does change all the other tags for posts under the category of “news”. But obviously they should not all be linked like that. The tags for the individual posts under other categories work as they should.

    Any suggestions on how to fix this? Maybe it has to do with my functions.php file?

Viewing 9 replies - 1 through 9 (of 9 total)
  • There’s nothing obviously wrong with the code you gave above, so the issue must be somewhere else. It could be your theme’s functions.php file or the current template file. You need to review anything that amends the current query or perhaps calls secondary queries.

    Here’s my functions.php

    I’ll have to disable plugins and see what happens as well, because it was working fine a couple of weeks ago.

    Nothing stands out as an obvious cause for your problem in that file. Where are these random tags being listed? In archive pages or on single post pages?

    single pages, but only those from a specific category. Let me know if you want me to post some templates. I do have custom templates for a few categories that work properly. It’s the one that doesn’t have a custom template that is wonky.

    Then the problem must lie within the single.php template file in your theme.

    Here’s the single.php:

    I’m using the Custom Sidebars plugin so that I can have different sidebars for each page. When I change the “news” sidebar to a “projects” sidebar, the tags work fine. So it just doesn’t work for one specific sidebar. But that could be a template issue as well…not sure.

    That sounds like a Loop issue in your news sidebar.

    I figured it out. “Executable PHP widget” plugin was causing a conflict with my Custom Widgets. Never happened before. I’ll just move the PHP code to the Custom Widgets area because it accepts PHP too. There must have been a reason why I needed the EPW plugin, but I think the newer version of WP and these plugins should make it OK for me to get rid of one of them.

    Thanks for all the help though!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘News posts taking on random tags’ is closed to new replies.