Only display custom field if it there is a value inside

use empty function to check if the return value is empty or not: <?php if ( function_exists(‘get_custom_field_value’) ): $custom_field_value = get_custom_field_value(‘Essential info 5′, true); if(!empty($custom_field_value)): ?> <li><span> <?php echo $custom_field_value; ?> </span></li> <?php endif; endif; ?> also check if the function ‘get_custom_field_value’ is returning with echo statement, you may need to change that to just … Read more

Adding a prefix to a post title

There are probably a few ways to handle this. Here’s one way using a checkbox to enable the prefix for individual posts, and a filter on the_title to add the prefix whenever the_title() is called for those posts. 1. Add a meta box for an on/off checkbox a. Add the meta box to the post … Read more

use get_posts to get custom field data, but in one array

You can alter your foreach loop as following to get concert date and city pair in single multidimentional array as following. $concert_query = array(); $i = 0; foreach($c_query as $post) : setup_postdata($post); $concert_query[$i][‘concert_date’] = get_post_meta(get_the_ID(), ‘concert_date’, true); $concert_query[$i][‘concert_city’] = get_post_meta(get_the_ID(), ‘concert_city’, true); $i ++; endforeach; print_r($concert_query);