Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #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?

    #270526

    Ha, 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.

    #270928

    Hi!

    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,
    Ismael

    #271033

    Hi 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

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Mit einem Mal sind Related Posts verschwunden’ is closed to new replies.