Support » Plugin: Yet Another Related Posts Plugin (YARPP) » [Plugin: Yet Another Related Posts Plugin] Problem with template system

  • Resolved zonademagia

    (@zonademagia)


    Hi, recently I update to the lastest version of YARPP but I cant make work the template system.

    I created my own template but when I call it in single.php it doesn’t display. I see the native template of YARPP.

    These are the codes I am using:

    Template (called yarpp-template-avenue.php and placed in my theme folder):

    <?php /*
    Entradas relacionadas
    Author: mitcho (Michael Yoshitaka Erlewine)
    */
    ?>
    
    <?php if (have_posts()):?>
    <?php while (have_posts()) : the_post(); ?>
    	<div class="related-item">
    		<?php $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'related-thumb'); ?>
    		<a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'><img src="<?php echo $image[0]; ?>" alt="<?php the_title(); ?>" width='134' height='90' /></a>
    		<h4><a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'><?php the_title(); ?></a></h4>
    	</div>
    <?php endwhile; ?>
    
    <?php else: ?>
    <p>No hay artículos relacionados.</p>
    <?php endif; ?>

    Function in single.php:

    `<?php yarpp_related(array(
    ‘past_only’ => false, // show only posts which were published before the reference post
    ‘exclude’ => array(), // a list of term_taxonomy_ids. entities with any of these terms will be excluded from consideration.
    ‘recent’ => false, // to limit to entries published recently, set to something like ’15 day’, ’20 week’, or ’12 month’.
    ‘weight’ => array(
    ‘title’ => 2,
    ‘tax’ => array(
    ‘post_tag’ => 4,
    ‘category’ => 1,
    )
    ),
    ‘require_tax’ => array(
    ‘post_tag’ => 1
    ),
    ‘threshold’ => 5,
    ‘limit’ => 8,
    ‘order’ => ‘score DESC’,
    ‘template’ => yarpp-template-avenue.php // either the name of a file in your active theme or the boolean false to use the builtin template

    ),
    $reference_ID,

    true); ?>`

    Any idea?

    Thanks! Great plugin!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Are you missing quotes around the string yrpp-template-avenue.php?

    By the way, is there a reason you’re not just using the YARPP settings page to choose your template?

    Wow! That’s was the error! I feel so stupid! 🙂

    The reason for do that is that the idea was have more control for multiple areas of related post in a same post.

    Thanks for the help! You are very fast and efficient! 😉

    Greetings from Argentina!

    No problem. Don’t forget to rate the plugin on the plugin page. 😉 Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Yet Another Related Posts Plugin] Problem with template system’ is closed to new replies.