Output custom field value
I would suggest you could try something like this to insert the Skype id by using get_post_meta: if (get_post_meta($post->ID, ‘Skype_ID’, true) == true) { echo get_post_meta( $post_id, “Skype_ID”, true ); }
I would suggest you could try something like this to insert the Skype id by using get_post_meta: if (get_post_meta($post->ID, ‘Skype_ID’, true) == true) { echo get_post_meta( $post_id, “Skype_ID”, true ); }
You’ve got a missing ) and you’re passing true as a string and not a boolean value. So this line: $pName = get_post_meta($post->ID, $productName, ‘true’; Should in fact be: $pName = get_post_meta($post->ID, $productName, true); In light of your update why not do something like: echo ‘Product Name: ‘. $pName[‘productName’][0]; echo ‘Location: ‘. $pName[‘locationName’][0]; echo ‘Address: … Read more
If you are asking if there is native way then the answer is no. While simpler and older representation of meta queries using meta_key and meta_value would technically fit into URL, they are not registered as public query variables. Even considering registering them as such would be too dangerous in a blanket way, because that … Read more
Problem solved. Added the following to my function: global $post;
Use get_field instead of the_field. That way you can assign it to a varilable. $first_comment = get_field(‘first_content_block’); $second_comment = get_field(‘second_content_block’); echo do_shortcode(“[vr_jsp] $first_comment, $second_comment [/vr_jsp]”); I haven’t tried it, but see if that works.
Firstly, it isn’t an error, it’s a warning: Warning: Invalid argument supplied for foreach() It’s showing as an error because your PHP is configured that way. Research error logging levels for more details. As for why it’s happening: $my_custom_field = $custom_fields[‘_source_link’]; //key name foreach ( $my_custom_field as $key => $value ) echo $key . ” … Read more
“Call to member function format() on a non-object” means that $formatted_date is not an object. Why do you need 2 functions for this? Can’t you just check the post meta for your custom field in the save routine? Especially with such a late priority the custom field should already be saved. function acf_set_expiry($post_id) { if … Read more
There is, in fact! The global variable $wp_registered_sidebars stores the registered sidebars, and $wp_registered_widgets stores all registered widgets (by widget ID).
I think what you are looking for is get_post_meta() $courtesty = get_post_meta( get_the_ID(), ‘courtesy’, true ); // check if the custom field has a value if( ! empty( $courtesty ) ) { echo ‘<div class=”courtesy”>’ . $courtesty . ‘</div>’; }
If you want to display a single custom field (post meta) then you can use: get_post_meta(); It has three arguments. The ID of the post The name of the post meta field (country_flag) Whether or not the value returned is a single string (in your case it will be); So the usage might be something … Read more