plugin-list-category-post custom fields

You can use get_post_meta(). This is the codex article: http://codex.wordpress.org/Function_Reference/get_post_meta It sounds like each of the custom field values you want to display would only contain one result (one country, one town etc). In that case you’d use something like this in your template, wherever you want to display the value: <?php if ( get_post_meta($post->ID, … Read more

Update custom category fields front-end

the function wp_insert_term returns the newly created term id (or WP_Error on error), so once your create your term you need to store it’s ID and then you can save the “extra fields” using get_option, update_option something like: if($_SERVER[‘REQUEST_METHOD’] == “POST”) { $clientName = $_POST[“clientName”]; $term_id = $_POST[“clientName”]; $clientKeywords = $_POST[“clientKeywords”]; $clientSlug = $_POST[“clientSlug”]; $parent=””; … Read more

Custom Post Type Meta Box Text Input Field Won’t Save When Blank

The problematic line is this one: if (isset($_POST[“book_title”]) && $_POST[“book_title”] <> ”) update_post_meta($post->ID, “book_title”, $_POST[“book_title”]); That logic says: If the submitted form contains a field called ‘book_title’ and if the content of the ‘book_title’ field does not equal an empty string, then save it. In your situation, the first condition should be met (HTML input … Read more

How do I include a template file while allowing it to render its own dynamic content added via custom box?

You can include any template you want using get_template_part() e.g.: <?php get_template_part(‘navigation’); ?> Using this function also gives you child/parent theme support. Also of note, you could put: <?php get_template_part(‘navigation’,’search’); ?> Which would attempt to load navigation-search.php, but if that isn’t found or doesn’t exist, it will fallback and load navigation.php instead. I use this … Read more

Need help with simple “if statement” checks to output particlular CPT data depending on what client uploads/fills out

You’ve got some basic syntax problems. Your elseif statement wasn’t actually checking anything and wasn’t properly wrapped in parenthesis. The logic more appropriately checks if the first condition is true, then if the second condition is true, and finally if all else fails, display the hard coded image. <?php $meta_box_topbanner_url = get_post_meta( $post->ID, ‘meta_box_topbanner_url’, true … Read more

How to show certain data on certain interval of period

Here’s a function you can put in functions.php. function get_current_event() { global $post; $now = get_the_time(‘U’); $year = get_the_time(‘Y’); if($now >= strtotime(“January 1 $year”) && $now < strtotime(“March 1 $year”)) { return get_post_meta($post->ID,’eventA’,true); } if($now >= strtotime(“March 1 $year”) && $now < strtotime(“October 15 $year”)) { return get_post_meta($post->ID,’eventB’,true); } $nextyear = $year+1; if($now >= strtotime(“October … Read more