Recent Posts Breaking Page Layout

NOTE: The Recent Posts plugin I'm referring to did not appear in the drop down menu when starting this topic, likely because I've reverted to the old drop-in mu plugin to get a screenshot for comparison.

ISSUE: After upgrading to the latest Post Indexer and Recent Posts (Function & Shortcode) plugins, I've encountered a couple issues that I need to address before updating on our live site.

1. Posts from the main site (id=1) are not appearing in the Recent Posts display that I have hard-coded into the page template using the function provided in the plugin. Primary site blog posts are also not appearing in the Recent Posts Widget (separate plugin), so I'm led to believe this is an issue with Post Indexer. But blog posts from numerous other sub-sites are indeed appearing. the main site's Privacy settings are searchable, and I have re-indexed the site a couple times, but still no posts appear in Recent Posts.

2. After upgrading to Recent Posts 3.0, the page including the function breaks. See screenshots to compare. In the first one with no markups, we see Recent Posts v. 1.0.1 in action with page content from the WP editor appearing at the bottom. The marked up screen shot, shows no posts from the main blog and the page content is gone, replaced instead by content of the next most recent global post even though only four are specified to show in the variables.

In both cases, the following code is being used:

?php display_recent_posts(4,45,100,'<br />','<strong>','</strong>','<ul>','</ul>','<li>','...</li>','yes','yes',32, 'post', true); ?

Just for kicks, I published a test page using the Recent Posts shortcode, and that is rendering properly, but still no posts from site id 1.

Any chance Barry might have a sec to provide feedback?

FYI: I didn't provide a link only because I am actively troubleshooting this so there's no telling what version of the various plugins involved may be active at the time.

Thanks in advance for any help!

  • jcnjr

    Hi Barry, thanks for checking in. Sorry for any confusion. I just updated to Post Indexer 3.0.3 and issue persists.

    First, to answer your question. Yes, site ID 1 is being indexed but the Statistics pop-up window is blank as shown in the new screenshot below. The Site Index Summary for other sites displays a graph as expected.

    For clarification, what I'm trying to show in the two screenshots is that the legacy Recent Posts plugin (now called Recent Posts Function and Shortcode) displays the appropriate recent posts, including any from the main site without affecting page layout. In the second marked up screen shot, there is no post from site ID 1 AND the page content entered using the WP Page/Post editor is being replaced by content from the next most recent global post.

    This latter behavior leads me to believe something wonky is going on with the Recent Posts (if not in addition to Post Indexer). So I tried comparing the new plugin file to the previous version. Much of the code is over my head, but recent-posts.php v. 3.0 is clearly missing the closing ?> tag. Adding that, however, made no difference in my case.

    Thanks again for your help. Get that coffee yet?

  • aecnu

    Greetings jcnjr,

    Thank you for the additional input as always and will bring to @Barry attention of this item: recent-posts.php v. 3.0 is clearly missing the closing ?> tag if he has not already fixed it.

    Regarding the production site, in any event I would do a full backup of both the site and database prior to updating. It is extremely rare that development environments match the production environment and therefore I am hesitant to rely on results strictly form a development environment in which there are so many people who find different reactions i.e. works on development environment and not on production environment and vice verse.

    Unfortunately we cannot look at your development site? And I cannot replicate this issue on my test production server as shown in my screen shot below.

    Please advise and hopefully Barry will find the time soon to come back in here and re-address this item.

    Cheers, Joe

  • jcnjr

    Thanks for checking in on this Joe. You are correct, out dev install is not in perfect sync with our live site.

    Unless someone can provide some direction for fixing the close tag issue, guess I'll just wait for an update and try again.

    I'm inclined to leave our live site as is since it the hardcoded Recent Posts are currently working and another theme overhaul is in the horizon, at which time we may consider using the new shortcode function.

  • jcnjr

    Thanks Barry, guess that explains why adding the closing tag didn't make a difference. But it still doesn't explain what's going on in our case. I'm still trying to figure out if the root cause of the layout breaking is the post indexer or Recent Posts update... still leery of updating our live site before getting this sorted out.

    If nobody has any further suggestions, guess I'll just live with the older versions until we overhaul the theme and use the new shortcode.

  • aecnu

    Greetings jcnjr and Barry,

    @Barry Thank you Chief for letting us know about the reason for the end tag missing and that it is indeed intentional and why.

    This is to reduce the chance of extra whitespace at the end of the file that causes "header already sent" messages.

    @jcnjr I understand why you have chosen to delay upgrading and agree with the "do not fix it if it is not broken" choice you have made rather then fighting to come up with a solution at this time.

    Thanks again for you valuable input as always and I will keep my eyes and ears open for any other reports of this issue though to date I have not seen any.

    Cheers, Joe