• I have a few posts that have custom fields:

    one field is country and the value could be United States or Germany or Brazil

    so if i have 10 posts, and 5 of my posts have country values of United States, how do i call this posttitle and attached image?

    I want to display the results in a widget but…

    im struggling with my own made code but its not working:

    <?php
    if($post)
    $country = get_posts('meta_key=country, meta_value=united states');
    else
    $country = 'no similar country found'
    
    shuffle($country);
    
    ?>
    
    <?php echo $country ?>

    and i have no idea how to call the attached image :/

    anyone can help me?

  • The topic ‘get post title and attached image via custom field’ is closed to new replies.