Meta box value shortcode
-
Hi,
I’m trying to achieve the following:
A shortcode of my Custom Post Type “Testimonials”. In the WordPress editor the user enters the ID of the testimonial post (like [testimonial id=”74″]) and then the shortcode displays the correct testimonial.In my shortcode file I’ve got the following code to get the title and content of the testimonial:
$testimonial_id = get_post($id);
$testimonial_title = $testimonial_id->post_title;
$testimonial_content = $testimonial_id->post_content;
This works perfect. But I’ve also got 1 meta box value I would like to get. But how do I retrieve this value?
I’ve tried this:
get_post_meta($testimonial_id, 'testimonial_company', true);
Unfortunately this doesn’t work.
Does someone has an idea of what I’m doing wrong??
Thanks in advance!
- The topic ‘Meta box value shortcode’ is closed to new replies.