After upgrading to version 4.0.3, I have found that related posts appear on static pages, not just on posts, when those static pages include posts using shortcodes. This didn’t happen before the new release.
To see this happen, see my site’s home page at http://www.TrustworthyCare.com
Everything in the left column on that page after the CTA “Call 1-800-777-4750 Today for Your FREE In-Home Assessment!” is a post that is used as an include file with a shortcode plugin called get posts.
Before taking the upgrade, the list of related posts at the end of the page did not appear.
@tcolling, go to the YARPP settings page and make sure the “automatic display” setting has “pages” turned off.
“make sure the “automatic display” setting has “pages” turned off.”
Yes, it is. This is really weird.
Any other ideas? I had disabled YARPP after I didn’t receive a reply to my post after a day or two, but now I’ve re-enabled it so that you can see the effect that it has on my home page at http://www.TrustworthyCare.com
Thanks for turning it on again. My guess is that YARPP is being tricked into thinking that it’s at the end of a post, not the end of a page, because of the “get posts” shortcode you’re running to load some other posts. If you turn off that shortcode, do they go away? Also, are the related posts listed related to your homepage content or to the post(s) that’s pulled in by that shortcode?
“My guess is that YARPP is being tricked into thinking that it’s at the end of a post, not the end of a page, because of the “get posts” shortcode you’re running to load some other posts. If you turn off that shortcode, do they go away? “
Yes, they do.
“Also, are the related posts listed related to your homepage content or to the post(s) that’s pulled in by that shortcode?”
It’s a little hard to be sure, but I believe that they’re related to the post that is pulled in by the get_posts shortcode. By the way, I have actually replaced the get_posts shortcode plugin with a different plugin called “Display Posts Shortcode” plugin, and YARPP still pulls in the same related posts.
Here’s a relevant question: I’m using these posts as “include files” if you understand what I mean. If I created a custom post type for them, called “includes”, instead of just creating them as regular WP Posts, would that trick YARPP into ignoring them?
Could you post a link to this Display Posts Shortcode plugin you’re using? I’d like to try to reproduce this issue myself. Thank you!
I just tried installing that plugin, but was unable to reproduce this issue. Here’s what I did:
1. Install that plugin
2. Create a new page
3. In that page, call [display-posts tag=’algorithm’]
4. In the published page, those many posts were listed, but YARPP was not.
My YARPP settings were “automatic display” on for posts but not pages. What I got was the expected behavior.
Am I doing something different than you?
I followed the steps in your message above, and I can reproduce the problem. The difference is that I use this set of arguments with the shortcode:
[display-posts tag="home_page" include_content="true" ]
and it produces the result you can see with the YARPP output, at:
So, it appears that the problem may arise when I use the include_content=”true” argument with that shortcode.
Does that help you narrow down what could be causing the problem?
Thanks! I really appreciate all the time you are taking to look into this.
Hi – I just tried your modification to my test case. I see that each of the posts’ content is being pulled, including their associated “related posts”. This is expected: within that context, it thinks it’s displaying an archive of posts, and I have “automatic display: posts” turned on, with “Also display in archives” turned on. If I turn off “Also display in archives”, it will not display on archives of posts, and therefore it disappears here too.
So, unfortunately, this is expected behavior and I don’t think there’s anything on the YARPP side that I’d like to do to circumvent this interaction. I suggest you turn off the “Also display in archives” option. You can manually make it so that related posts are displayed in archives by adding the code
related_posts()to your PHP theme files for archives.
Hi Michael –
Thank you VERY much for spending so much time looking into this. I really appreciate it.
One last question: This whole issue arises from my using a special category of posts as “include files” on some static pages. If I created a custom post type (in the WordPress sense) called something other than “Posts”, would YARPP ignore those? I could use a plugin that can display custom post types in order to display them on the static pages, if that would prevent YARPP from responding to them.
- The topic ‘Related posts appear on static pages, not just post pages with 4.0.3’ is closed to new replies.