Getting movie and serial on actor page

Hy,

i resolve a problem, a liitle question, how can i get the text if nothing is selected in custom field ( distributie_serial).
Ex: no serial for this actor.

This is the Code that works.

<?php 
$seriale = get_posts(array('post_type' => 'serial',
     'meta_query' => array(
                     array('key' => 'distributie_serial', // name of custom field
                           'value' => '"' . get_the_ID() . '"',
                           'compare' => 'LIKE'))
                        ));
?>
<?php if( $seriale ): ?>
<?php foreach( $seriale as $serial ): ?>
<div class="actor-box-related">
<a class="actor-titlu" href="https://wordpress.stackexchange.com/questions/84426/<?php echo get_permalink( $serial->ID ); ?>">
<img class="actor-img" src="/scripts/timthumb.php?src=<?php echo get_field('imagine_serial', $serial->ID); ?>&h=90&w=60&zc=1" alt="<?php echo $photo['alt']; ?>" />
<?php echo get_the_title( $serial->ID ); ?>
</a>
</div>

<?php endforeach; ?>
<?php endif; ?>

Leave a Comment