Tagged: related posts
-
AuthorPosts
-
May 27, 2014 at 2:19 pm #270524
Bisher hatte ich die Related Posts ja immer bei den Blogbeiträgen. Doch als ich eben auf einer Kundenwebseite deren fehlen bemerkte, guckte ich auf meiner Site nach und die waren da auch nicht mehr da.
Im Enfold Child geprüft und ja: die Einstellungen sagen “Related Posts” anzeigen. Habe beide Anzeigemöglichkeiten geprüft, keine Änderung.
Hab ich da was übersehen oder ist ein Bug schuld?
May 27, 2014 at 2:22 pm #270526Ha, ich finde doch noch welche. Sind die Related Posts nur vom Keyword/Schlagwort/Stichwort abhängig? Nicht auch von der Kategorie? Dann muss ich da noch mal ran.
May 28, 2014 at 1:25 am #270928Hi!
Thank you for using the theme.
Related posts are set for posts with the same post tags. You’ll need to add the same tags for posts if you want the related post section to show. If you want, you can set the related section to show by category instead of tags. Edit includes > related-posts.php, find this code on line 71:
$my_query = get_posts( array( 'tag__in' => $tag_ids, 'post_type' => get_post_type($this_id), 'showposts'=>$postcount, 'ignore_sticky_posts'=>1, 'orderby'=>'rand', 'post__not_in' => array($this_id)) );
Replace it with:
$cat_ids = array(); $categories = get_the_category($this_id); if($categories) { foreach($categories as $category) { $cat_ids[] = $category->term_id; } } $my_query = get_posts( array( 'tag__in' => $tag_ids, 'category__in' => $cat_ids, 'post_type' => get_post_type($this_id), 'showposts'=>$postcount, 'ignore_sticky_posts'=>1, 'orderby'=>'rand', 'post__not_in' => array($this_id)) );
Best regards,
IsmaelMay 28, 2014 at 9:34 am #271033Hi Ismael, thanks for reporting whats going on there. Maybe I didn’t recognize that in the past. Relations between post only by tags is OK, I have to remember that only next time.
Sometimes I wish I had only relations by tags in case of woocommerce, but they do it by tag and category, which gives often related products of very different kind.
But overall it is oK, I can live with as it is.
Thanks, Adrian
-
AuthorPosts
- The topic ‘Mit einem Mal sind Related Posts verschwunden’ is closed to new replies.