• Resolved jasonsweb

    (@jasonsweb)


    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!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Meta box value shortcode’ is closed to new replies.