This is a great little feature to have in your theme that saves the theme user using yet another plugin! It displays related posts based on tags, simply disappearing if there are no tags.
<?php if( function_exists('the_tags') )
// for use in the loop, list 5 post titles related to first tag on current post
$tags = wp_get_post_tags($post->ID);
if ($tags) {
echo '<h2>Related Posts</h2> ';
$first_tag = $tags[0]->term_id;
$args=array(
'tag__in' => array($first_tag),
'post__not_in' => array($post->ID),
'showposts'=>5,
'caller_get_posts'=>1
);
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<ul> <li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></li></ul>
<?php endwhile; }}?>
Zdroj: 10 tricks to make your WordPress theme stand out
YARP – plugin pro zobrazení souvisejících příspěvků
http://wordpress.org/extend/plugins/yet-another-related-posts-plugin/
umožňuje:
– nastavení množiny článků, ze kterých se budou podobné články vybírat
– nastavení kritérií, podle kterých se budou vybírat podobné články
– nastavení způsobu zobrazení podobných článků na webu
– nastavení způsobu zobrazení podobných článků v RSS kanálu
– určit váhu jednotlivých hodnotících kritérií (titulek stránky, text stránky, přiřazené štítky, umístění v kategoriích
Více: http://www.portiscio.net/jak-zobrazit-podobne-clanky-ve-wordpressu
*Alternativy:*
Contextual Related Posts
https://wordpress.org/plugins/contextual-related-posts/
A powerful plugin for WordPress that allows you to display a list of related posts on your website and in your feed. The list is based on the content of the title and/or content of the posts which makes them more relevant and more likely to be of interest to your readers. This allows you to retain visitors, reduce bounce rates and refresh old entries. Contextual Related Posts is one of the most feature rich related posts plugins for WordPress with support for thumbnails, shortcodes, widgets, custom post types, caching and CSS styles.
The plugin also comes with it’s very own inbuilt stylesheet that let’s your related posts look awesome!
