Forums

get post title and attached image via custom field (1 post)

  1. egjweb
    Member
    Posted 3 months ago #

    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?

Reply

You must log in to post.

About this Topic