• LoRyspect

    (@loryspect)


    Dear king,
    i’m trying to use your great plugin with Related post, but it always use the default wordpress category order.
    Please any help appreciate.

    Here the code:

    function get_related_posts($postdata)
    
    {
    	$postCatArr = wp_get_post_categories($postdata->ID);
    	$post_array = array();
    	for($c=0;$c<count($postCatArr);$c++)
    	{
    		$category_posts=get_posts('category='.$postCatArr[$c]);
    		foreach($category_posts as $post)
    		{
    			if($post->ID !=  $postdata->ID)
    			{
    				$post_array[$post->ID] = $post;
    			}
    		}
    	}
    if($post_array)
    {
    ?>
    <div class="realated_post clearfix">
    <h3><span>Localit&agrave; Simili</span></h3>
    
    <ul class="category_grid_view clearfix">
    <?php
    	$relatedprd_count = 0;
    	foreach($post_array as $postval)
    	{
    		$product_id = $postval->ID;
    		$post_title = $postval->post_title;
    		$productlink = get_permalink($product_id);
    		$post_date = $postval->post_date;
    		$comment_count = $postval->comment_count;
    		$text = $postval->post_content;
    		$length = 100;
    		$text = strip_tags($text);
    		if(strlen($text)>$length)
    		{
    			$text = substr($text, 0, $length);
    			$text = substr($text, 0, strrpos($text, " "));
    			$text = $text.' ...';
    		}
    		if($postval->post_status == 'publish')
    		{
    			$post_images = bdw_get_images($postval->ID,'large');
    
    			if($post_images[0]!='')
    			{
    				$relatedprd_count++;
    			?>

    https://www.ads-software.com/extend/plugins/custom-taxonomy-sort/

  • The topic ‘Related Post with Custom Taxonomy Sort’ is closed to new replies.