Forums

[Plugin: Yet Another Related Posts Plugin] yarpp displaying correct image & url but title is wro (6 posts)

  1. telescreen
    Member
    Posted 4 months ago #

    If you go to this post http://revivl.com/features/?p=39 you can see I have the image and link coming in correctly but the title displayed is that of the post I am currently reading. Here is the code i'm using:

    <div class="col1">
    <h2>Related Posts</h2>
    
    <?php
    $results = $wpdb->get_results(yarpp_sql(array('post'),array()));
    foreach ( (array) $results as $_post ) : ?>
    
    <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>
    
    <a href="<?php echo get_permalink($_post->ID); ?>" rel="bookmark"><?php echo get_the_title(); ?></a>
    
    <div class="hl2"></div>
    <?php endforeach; ?>
    </div>

    Thanks in advance for your help.

  2. xinfo
    Member
    Posted 4 months ago #

    well it show right title

    you see some thing like this /?p=70

    its b'cose you didn't set up your permalink

    you keep as default ,so you find different

    btw can you share what kind plugin your using for bands/artist registration ?

  3. telescreen
    Member
    Posted 4 months ago #

    I gave it a try but it didn't work. Only the featured page is wordpress. The artist sign up area is all custom php.

  4. mitchoyoshitaka
    Member
    Posted 4 months ago #

    @telescreen - the use of yarpp_sql directly is unsupported. Please use the new templating system built into YARPP 3:

    http://mitcho.com/blog/projects/yarpp-3-templates/

  5. Hein35
    Member
    Posted 2 months ago #

    @telescreen

    I see you've found the solution for this, please explain me the fix.

  6. jhulott
    Member
    Posted 1 month ago #

    @Hein35 - I had the same problem. If you use the @telescreen code above, the issue is in the line of code here:

    <a href="<?php echo get_permalink($_post->ID); ?>" rel="bookmark"><?php echo get_the_title(); ?></a>

    You need to change it to:

    <a href="<?php echo get_permalink($_post->ID); ?>" rel="bookmark"><?php echo get_the_title($_post->ID); ?></a>

    That works for me!

Reply

You must log in to post.

About this Topic