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> <?php $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 😀
Thanks in advance,
yarpp_sqlquery 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.
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 🙂
If I replace the old code (see above) with the following code:
<?php if ($related_query->have_posts()):?> <ol> <?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; ?> </ol> <?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 🙁
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:
No related posts were found, so here’s a consolation prize: .
@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.
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 :((
@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.
I had the same problem with version 3.3 but was able to fix it by replacing it with
@phillsmith which problem are you referring to?
i got a same problem with him
@mitcho (Michael ?? Erlewine) can help to fix it?
- The topic ‘[Plugin: Yet Another Related Posts Plugin] "No related posts." in two ways / Detailed desc’ is closed to new replies.