• Jon

    (@ezkim0x)


    I installed 2 plugins:

    http://wordpress.org/extend/plugins/just-custom-fields/
    http://wordpress.org/extend/plugins/ip2country/

    ip2country displays the country code correctly using:

    <?php
    $ip2country = ip2country();
    echo $ip2country->country_code;
    ?>

    and just custom field displays all the countries I have ticked by checkboxes by using:

    <?php
    $countries = get_post_meta($post->ID, 'post_geo', true);
    ?>

    and

    <?php
    foreach($countries as $country) echo $country.',';
    ?>

    I’ve read the_loop references, but i’m afraid i’ll end up messing it up.. can anyone help me with the code I should be putting in my loop to only show posts based on if the ip2country_code isin custom_field_array

The topic ‘show posts based on country (custom_fields)’ is closed to new replies.