venkat123
Forum Replies Created
-
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(); ?>
- ” rel=”bookmark”><?php the_title(); ?>
<?php endwhile; ?>
<?php else: ?>
<p>No custom filed.</p>
<?php endif; ?>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(); ?>
- ” rel=”bookmark”><?php the_title(); ?><!– (<?php the_score(); ?>)–>
<?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
MessageHI
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(); ?>
- ” rel=”bookmark”><?php the_title(); ?><!– (<?php the_score(); ?>)–>
<?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.