Support

Account

Forum Replies Created

  • Hi,

    Yes it’s exactly what i want and i figure out how to solve.

    I mess up with the code and i see it’s quite simple. I attach the final code in custom posts.

    Thanks and regards,

    $related_articles = get_posts(array(
        'post_type' => 'post',
    	'posts_per_page' => 5,
        'meta_query' => array(
            array(
                'key' => 'nociticias_relacionadas', // name of custom field
                'value' => '"' . get_the_ID() . '"',
                'compare' => 'LIKE'
            )
        )
    ));
    
    if( $related_articles ): 
        foreach( $related_articles as $article ): 
    
    	$imag = get_the_post_thumbnail( $article->ID, 'noticias' );?>
                    
    	<li class="noticiasr" style="display: inline;">
                    
               <div class="parafade" style="float:left; max-width: 212px; text-align:center; font-size:12px; color:#aaaaaa; margin-right: 6px; line-height: 18px;">
          	   <div class="fondo"><a href="<?php echo get_permalink($article->ID); ?>"> <?php echo $imag; ?> </a></div>
               <?php echo get_the_title($article->ID); ?>
              
               </div>
          	</li>
    endforeach;
    endif; 
Viewing 1 post (of 1 total)