Yet Another Related Posts Plugin (YARPP)
[Plugin: Yet Another Related Posts Plugin] "No related posts." in two ways / Detailed desc (12 posts)

  1. stiwi
    Posted 3 years ago #

    Hi there,

    I created a new wordpress blog with a template boought at templatesold.com. (http://www.templatesold.com/templates/wordpress-themes/wp-personal_creative/graffitiblue/5656.html)

    In the package I have the theme files and all the used plugin files. YARPP is a used plugin too.

    But the creator of the template used an older version (3.1.3) of the plugin and had used the following code for the single.php:

    <h2>Verwandte Beitr├Ąge</h2>
    					$results = $wpdb->get_results(yarpp_sql(array('post'),array()));
    					foreach ( (array) $results as $_post ) :
    					$_post = get_post($_post->ID);  ?>  
                      <div class="th fl"><a href="<?php echo get_permalink($_post->ID); ?>"><img src="<?php echo get_post_meta($_post->ID, 'post-img', true); ?>" alt="" /></a></div>
                      <div><a href="<?php echo get_permalink($_post->ID); ?>"><?php echo $_post->post_title; ?></a></div>
                      <div class="hl2"></div>
                      <?php endforeach; ?>

    Unfortunately it seems that there is no reaction in the frontend under "Verwandte Beitr├Ąge" (see: http://spass-junkies.de/v2/2011/02/14/afrikaner-betrugt-seine-frau-mitten-im-leben/).

    Furthermore I activate the option that posts get automatic the realted posts. Please see under the youtube video "Related Posts".

    The relevance is = 0.

    I used the older version: It didn't work. I used the newer version: It didn't work.

    I'm no PHP expert, so I can't update the code by my own, but with some tipps and some solutions I will get this plugin running :)

    Hope anyone can help me :) Particurlarly mitcho :D

    Thanks in advance,

  2. mitcho (Michael Yoshitaka Erlewine)
    Plugin Author

    Posted 3 years ago #

    Calling the yarpp_sql query is *not* supported, and is a bad idea! I'm really sorry that the theme you purchased does this, and you should tell them that they're doing it wrong!

    Instead, you should just remove that code and instead replace it with related_posts(). If you need to modify the way related posts are displayed, you should use a YARPP template instead.

  3. stiwi
    Posted 3 years ago #

    Hey mitcho!

    Thanks for your answer! :)

    Oh okay I did not know that I can't use the yarpp_sql query. And unfortunately I don't know how to fix it :(

    Could you give me an exeample how fix the code you see above?

    Thanks in advance :)

  4. stiwi
    Posted 3 years ago #

    If I replace the old code (see above) with the following code:

    <?php if ($related_query->have_posts()):?>
    	<?php while ($related_query->have_posts()) : $related_query->the_post(); ?>
    		<?php if (function_exists('has_post_thumbnail')): if (has_post_thumbnail()):?>
    		<li><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail(); ?></a></li>
    		<?php endif; endif; ?>
    	<?php endwhile; ?>
    <?php else: ?>
    <p>No related photos.</p>
    <?php endif; ?>

    I get the following error:

    Fatal error: Call to a member function have_posts() on a non-object in /srv/www/spass-junkies.de/v2/wp-content/themes/graffitiblue/single.php on line 75

    I don't know how to deal with this issue :(

  5. stiwi
    Posted 3 years ago #

    Okay I replaced the new code with:

    <?php related_posts() ?>

    But if I choose the YARPP Template: "yarpp-template-random.php" I get the following output in the frontend:

    Related Posts

    No related posts were found, so here's a consolation prize: .

  6. mitcho (Michael Yoshitaka Erlewine)
    Plugin Author

    Posted 3 years ago #

    @stiwi, replacing that code with related_posts() is correct. I would suggest not using a YARPP template, though, and making sure you get results in general. You may want to tweak the "Relatedness" options.

  7. stiwi
    Posted 3 years ago #

    Hi mitcho,

    thx for your answer. Unfortunately there are no results anyway.

    Maybe I have an answer (can you confirm that?): I set up a new wordpress system. After that I import all posts from another wordpress system. After that I installed YARPP. Now I have no related post, because all posts were written in the database by importing them. So YARPP can't "crawl" through the informations like headlines, text,.. because I do not create further posts.

    Could that be?

    By the way: After the installation YARPP there was an alert, that I have to approve that a database mode options is activated which is required for YARPP. Maybe there's a mistake? What do you think?

    Thank you so much for your help. I really despair of it :((


  8. mitcho (Michael Yoshitaka Erlewine)
    Plugin Author

    Posted 3 years ago #

    @stiwi, YARPP should be able to generate results even if you don't create new posts. However, the alert you saw when installing YARPP may be more concerning... do you have the text of that alert? Can you reproduce it? It's possible that that is the key here.

  9. phillsmith
    Posted 3 years ago #

    I had the same problem with version 3.3 but was able to fix it by replacing it with


  10. mitcho (Michael Yoshitaka Erlewine)
    Plugin Author

    Posted 3 years ago #

    @phillsmith which problem are you referring to?

  11. zorzch
    Posted 3 years ago #

    i got a same problem with him
    @mitcho (Michael ?? Erlewine) can help to fix it?

  12. mitcho (Michael Yoshitaka Erlewine)
    Plugin Author

    Posted 3 years ago #

    @zorzch, which problem exactly? There are (unfortunately) multiple problems described here.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic