WordPress.org

Support

Support » Plugins and Hacks » Yet Another Related Posts Plugin (YARPP) » [Plugin: Yet Another Related Posts Plugin] yarpp.3.4.2 – display related posts only when custom file

[Plugin: Yet Another Related Posts Plugin] yarpp.3.4.2 – display related posts only when custom file

Viewing 5 replies - 1 through 5 (of 5 total)
  • Turn off the “automatic display” option, then you can write some code in your theme:

    if (check custom field is set here)
    related_posts();

    HI
    Thanks for your responce.Need some more clarification on this.
    1. create a custom field by editing the post.
    2. Turn off the “automatic display” option under Plugins –>Yet Another Related Posts Plugin –> settings —>display options for your website —> then uncheck the automaticall display related posts.
    After above changes i have written below code in yarpp-template-example.php page.

    <?php /*
    Example template
    Author: mitcho (Michael Yoshitaka Erlewine)
    */
    ?><h3>Related Posts</h3>

    < ?php query_posts(‘meta_key=review_type&meta_value=movie’); ?>

    <?php if ($related_query->have_posts()):?>

      <?php while ($related_query->have_posts()) : $related_query->the_post(); ?>

    1. ” rel=”bookmark”><?php the_title(); ?><!– (<?php the_score(); ?>)–>
    2. <?php endwhile; ?>

    <?php else: ?>
    <p>No related posts.</p>
    <?php endif; ?>

    this is the right way to display related posts only when custom filed is set in a post.
    I am new to wordpress.Please help me out to resolve this issue.

    HI
    Thanks for your responce.Need some more clarification on this.
    1. create a custom field by editing the post.
    2. Turn off the “automatic display” option under Plugins –>Yet Another Related Posts Plugin –> settings —>display options for your website —> then uncheck the automaticall display related posts.
    After above changes i have written below code in yarpp-template-<?php /*
    Example template
    Author: mitcho (Michael Yoshitaka Erlewine)
    */
    ?><h3>Related Posts</h3>

    <?php if(query_posts(array(‘meta_key’ => ‘review_type’,’meta_value’ => ‘movie’))):?>

    /*<?php if (query_posts(‘meta_key=review_type&meta_value=movie’)); ?>*/

    <?php if ($related_query->have_posts()):?>

      <?php while ($related_query->have_posts()) : $related_query->the_post(); ?>

    1. ” rel=”bookmark”><?php the_title(); ?><!– (<?php the_score(); ?>)–>
    2. <?php endwhile; ?>

    <?php else: ?>
    <p>No related posts.</p>
    <?php endif; ?>

    this is the right way to display related posts only when custom filed is set in a post.
    I am new to wordpress.Please help me out to resolve this issue.

    Reply
    Message

    HI
    below code i am using to display related posts only when custom filed is set in a post.
    But its not working.Please let me know where i am going wrong.

    <?php /*
    Example template
    Author: mitcho (Michael Yoshitaka Erlewine)
    */

    <h3>Related Posts</h3>

    <?php if ( get_post_meta($post->ID, ‘hide_yarpp’, true) ) : ?>

    <?php if ($related_query->have_posts()):?>

      <?php while ($related_query->have_posts()) : $related_query->the_post(); ?>

    1. ” rel=”bookmark”><?php the_title(); ?>
    2. <?php endwhile; ?>

    <?php else: ?>
    <p>No custom filed.</p>
    <?php endif; ?>

    You don’t want to do this in a custom template. You want to do this in your your theme’s template.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Yet Another Related Posts Plugin] yarpp.3.4.2 – display related posts only when custom file’ is closed to new replies.
Skip to toolbar