WordPress.org

Support

Support » Plugins and Hacks » [Resolved] [Plugin: Yet Another Related Posts Plugin] 3.5.1- No Related Posts

[Resolved] [Plugin: Yet Another Related Posts Plugin] 3.5.1- No Related Posts

Viewing 15 replies - 16 through 30 (of 32 total)
  • This might help you: (sorry, bit messy code)

    <?php $tags = wp_get_post_tags($post->ID);
    				if ($tags) {
    					$tag_ids = array();
    					foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;
    					$args=array(
    					'tag__in' => $tag_ids,
    					'post__not_in' => array($post->ID),
    					'showposts'=>5, // Number of related posts that will be shown.
    					'caller_get_posts'=>1
    				);
    				$my_query = new wp_query($args);
    				if( $my_query->have_posts() ) {
    
    					echo '<h3>Products related to '. get_the_title() .'</h3>';
    					echo '<ul>';
    					while ($my_query->have_posts()) {
    						$my_query->the_post();
    					?>
    						<li>
    							<h4>
    								<a href="<?php the_permalink() ?>" rel="bookmark" title="Read more about <?php the_title_attribute(); ?>">
    									<?php the_title(); ?>
    								</a>
    							</h4>
    							<a href="<?php the_permalink() ?>" rel="bookmark" title="Read more about <?php the_title_attribute(); ?>">
    								<?php the_post_thumbnail('related-product-thumbnail');?>
    							</a>
    
    						</li>
    					<?php
    					}
    					 echo '</ul>';
    				}
    }
    ?>

    I’ll add that I’ve been using YARP without error for a few years now.. so this is definitely not typical for the plug-in.

    It’s a great plugin, but it’s “heavy”. The code Ive pasted above will show you related post using tag. You can adjust it the way you want. I paste it straight from my site Under Construction.

    If you’re planning on using the featured imaged dont forget to add the support in your functions.php

    add_theme_support( 'post-thumbnails' );
    set_post_thumbnail_size( 150, 150, true ); // Normal post thumbnails
    add_image_size( 'single-post-thumbnail', 250,400, TRUE); // Your thumbnail size

    Hi dompl,

    Thanks!

    I actually just added a slightly cleaner version of your code and it works perfectly. I actually ashamed to admit that I’ve been planning on doing this for a while.. 😉

    Sometimes plug-ins are great for a quick fix, but you’re right, most are bloated and only add to taxing the overall system.

    <?php
    //for use in the loop, list 5 post titles related to first tag on current post
    $tags = wp_get_post_tags($post->ID);
    if ($tags) {
      echo 'Related Posts';
      $first_tag = $tags[0]->term_id;
      $args=array(
        'tag__in' => array($first_tag),
        'post__not_in' => array($post->ID),
        'showposts'=>5,
        'caller_get_posts'=>1
       );
      $my_query = new WP_Query($args);
      if( $my_query->have_posts() ) {
        while ($my_query->have_posts()) : $my_query->the_post(); ?>
          <p><a>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
          <?php
        endwhile;
      }
    }
    ?>

    Where do you get a copy of 3.3.3?

    Edit: nevermind, found it by changing the url to http://downloads.wordpress.org/plugin/yet-another-related-posts-plugin.3.3.3.zip

    I’ll replace 3.5.1 with 3.3.3 and see what happens…

    Ok, after a few days of running and posting new posts, I can comfirm that rolling back to 3.3.3 works perfectly.

    By the way, if the update notification bugs you, like it does me, edit the version number in the yarpp.php file, line 6, and change it to 3.5.1.

    Cheers,

    Plugin Author mitcho (Michael Yoshitaka Erlewine)
    Member

    @mitchoyoshitaka

    Hi all. Please try this latest beta, which fixes an issue with “no related posts” on some server environments: http://downloads.wordpress.org/plugin/yet-another-related-posts-plugin.3.5.2b2.zip

    Thank you!

    seandfeeney
    Member

    @seandfeeney

    This beta didn’t work for me. Still seeing posts without any related posts. If I could make a suggestion, could you add a button to select random posts if it can’t find any that are related?

    Plugin Author mitcho (Michael Yoshitaka Erlewine)
    Member

    @mitchoyoshitaka

    @seandfeeny there is a YARPP custom template that already ships with YARPP which can accomplish this.

    Sean, what happens if you lower your match threshold slightly in YARPP settings? This will clear the cache and force it to recompute things.

    seandfeeney
    Member

    @seandfeeney

    I have it set to 1…

    @seandfeeney: In theory, if you threshold is low enough, and if you have a relatively good amount of posts, you should get some posts, related or not.

    Plugin Author mitcho (Michael Yoshitaka Erlewine)
    Member

    @mitchoyoshitaka

    @seandfeeney hmm, do you see any posts “related” in the “related posts” box in your post edit screen? (If it’s hidden, show it from “screen options.” Are you using some caching system like W3 Total Cache or memcached?

    Otherwise, I would suggest you add the YARPP Experiments plugin which can help you flush the cache manually and force it to rebuild as well: http://wordpress.org/extend/plugins/yarpp-experiments/

    seandfeeney
    Member

    @seandfeeney

    I do have w3 cache enabled with minify disabled. It does work on some posts but, on the ones that doesn’t work, there are no related posts on the edit post page.

    Example… http://wp.me/p14H51-9a

    Plugin Author mitcho (Michael Yoshitaka Erlewine)
    Member

    @mitchoyoshitaka

    If you’re getting results on some posts, it’s not completely not working… I suggest you add that YARPP experiments plugin to try flushing and manually rebuilding the YARPP cache.

    seandfeeney
    Member

    @seandfeeney

    After many reloads and rebuilds (about 5) it finally shows 100%. I will see how this workaround goes, long-term. Thanks!

Viewing 15 replies - 16 through 30 (of 32 total)
  • The topic ‘[Resolved] [Plugin: Yet Another Related Posts Plugin] 3.5.1- No Related Posts’ is closed to new replies.