• I use YARPP with the “Automatically display related posts” option enabled and it works like a charm!

    However, when I try to use the widget (or the related_posts() function in a widget) I always get the same “related” posts for each post – and they are completely different from the related posts displayed by the automatically-option.

    Any hints?

Viewing 12 replies - 1 through 12 (of 12 total)
  • I have exactly the same problem, has anyone found a solution?

    FYI, it looks like the problem is that the widget code is outside the loop but is using $post to access the id of the current post. The id it gets is not correct and often invalid, which results in the same list of unrelated posts on each page. I fixed mine, temporarily, by replacing the function widget_yarpp_init with the version velow. Hopefully the author will get a real fix in soon.

    function widget_yarpp_init() {
    
    if ( !function_exists('register_sidebar_widget') || !function_exists('register_widget_control') )
    		return;
    
    	function widget_yarpp($args) {
    		extract($args);
    		global $wpdb, $post;
    		if (is_single() && have_posts()) {
    			while (have_posts()) {
    				the_post();
    				echo $before_widget;
    				echo $before_title . __('Related Posts','yarpp') . $after_title;
    				echo yarpp_related(array('post'),array());
    				echo $after_widget;
    			}
    		}
    	}
    	register_sidebar_widget(__('YARPP','yarpp'), 'widget_yarpp');
    }

    @luckykaa – thanks for figuring that out! I’ll incorporate a similar fix into my next update, 3.0.6.

    Hi all— please let me know if version 3.0.6 is working for you. Someone else mentioned that the post now does not show up for them…

    Thread Starter semper tiro

    (@semper-tiro)

    Thanks for the fix – 3.0.6 seems to solve the problem!

    Great. I just received another report that in some cases the post content itself won’t display right with my fix… I’ve updated a version (3.0.7b1) which may fix that.

    https://downloads.www.ads-software.com/plugin/yet-another-related-posts-plugin.3.0.7b1.zip

    I’d like to know if this additional fix is really necessary, though, so if I you find this issue and have to download this new version, and it works, please let me know.

    @mitchoyoshitaka – I’m planning on using YARPP on a new website of mine. I had it implemented, and it worked fine. But after I upgrade the wordpress from 2.7.1 to 2.8 yesterday I noticed the YARPP widget isn’t working any more.

    This problem persists after updating to YARPP 3.0.6.

    The “Automatically display related posts?” keeps on working fine, but I like to implement it the sidebar.
    If I use the “related_posts()” code from the manual install, then results do show up in the sidebar.

    I’m going to give v3.07b1 a try. Maybe it solves it all.

    Otherwise any ideas what could be the problem?

    The only weird thing I noticed is that the cache status always is “0% complete” after page reload.

    @wpcubus – please let me know if 3.0.7b1 fixed the issue.

    Also, regarding the 0% complete… that sounds like a totally different issue. If you’re getting results on your pages at all, though, it means that the caching is working, so that 0% display may be wrong… let me know if that’s still happening.

    @mitchoyoshitaka – Thanks for your quick reply.

    Too bad. I tried 3.0.7b1, but it didn’t solve the issue.

    Any ideas are still welcome.

    FYI: Same issue occurs on my local version (Wampserver)

    I’m getting the same issue, with the widget all posts display the same related posts. With the automatic display, the related results are unique to each post.

    https://www.jadedgamefans.com/ninja250blog/motomalism/sur-to-malibu-part-i/

    I tried luckykaa’s fix but it didn’t change anything.

    Thanks for the plugin Mitcho, appreciate any update you can give.

    I figured out the issue for me. Within my main loop for the page I had a get_posts call to display a list of recent posts–the last entry in that list was the post that the YARPP widget was responding to, so every page with that list had the same YARPP results.

    I placed <?php wp_reset_query(); ?> at the end of my get_posts list and now YARPP pulls related posts correctly.

    Sallee, that would do it. Glad you figured it out.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘[Plugin: Yet Another Related Posts Plugin] Widget and related_posts() problem’ is closed to new replies.