Get custom term meta problem on single post type

Possible solutions: Check if there’s a prefix which you setup for the custom field (https://en.bainternet.info/tax-meta-class-faq/#comment-1107) Go to the Tax-meta-class/Tax-meta-class.php file and find the function you’re calling and debug the issue: // Tax-meta-class.php public function get_tax_meta($term_id,$key,$multi = false){ $t_id = (is_object($term_id))? $term_id->term_id: $term_id; var_dump ($t_id); // debug this $m = get_option( ‘tax_meta_’.$t_id); var_dump ($m); // debug … Read more

Save all custom field data into one “master” custom field

This is assuming each of the fields is a single value and you want to create a list for display… add_action(‘edit_post’,’custom_combine_fields’); function custom_combine_fields($post_id) { $pirates = get_post_meta($post_id,’pirates’,true); $robots = get_post_meta($post_id,’robots’,true); $ninjas = get_post_meta($post_id,’ninjas’,true); $professions = array(); if ($pirates) {$professions[] = $pirates;} if ($robots) {$professions[] = $robots;} if ($ninjas) {$professions[] = $ninjas;} if (count($professions) > 0) … Read more

Conditional featured image with youtube thumbnail

There are three problems 1. echo and php tags within an echo Change your first echo from: echo ‘<img src=”http://img.youtube.com/vi/<?php echo get_post_meta($post->ID,’video_url’,true);?>/0.jpg”/>’; to this: echo ‘<img src=”http://img.youtube.com/vi/’ . get_post_meta($post->ID,’video_url’,true) . ‘/0.jpg”/>’; 2. if statement not wrapped and no brackets change: if get_post_meta($post->ID,’video_url’,true) to: if (get_post_meta($post->ID,’video_url’,true)) and add {} around that code block: if (get_post_meta($post->ID,’video_url’,true)) { … Read more

Query only displays one page_id

The p parameter accepts a single integer value, not a string or array of integers. You would want to use the post__in parameter which allows for an array of post id’s. Just a few notes here: You will need to check if you actually have a valid array of post ID’s before passing it to … Read more

Output custom text field as unordered list

This is more about string and array manipulation with php than a WordPress related question. The proper way to do it would be using a repeater field instead of a single text input. Advanced Custom Fields, which seems to be the plugin you are using, has a nice repeater addon. That would let the users … Read more