Forums

[Plugin: Yet Another Related Posts Plugin] Widget and related_posts() problem (10 posts)

  1. semper tiro
    Member
    Posted 5 months ago #

    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?

  2. luckykaa
    Member
    Posted 5 months ago #

    I have exactly the same problem, has anyone found a solution?

  3. luckykaa
    Member
    Posted 5 months ago #

    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');
    }
  4. mitchoyoshitaka
    Member
    Posted 5 months ago #

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

  5. mitchoyoshitaka
    Member
    Posted 5 months ago #

    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...

  6. semper tiro
    Member
    Posted 5 months ago #

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

  7. mitchoyoshitaka
    Member
    Posted 5 months ago #

    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.

    http://downloads.wordpress.org/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.

  8. wpcubus
    Member
    Posted 5 months ago #

    @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.

  9. mitchoyoshitaka
    Member
    Posted 4 months ago #

    @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.

  10. wpcubus
    Member
    Posted 4 months ago #

    @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)

Reply

You must log in to post.

About this Topic