I have searched high and low and none of the solutions I have found have worked for me.
I have created a custom post type call Testimonials and I have created two new custom post fields called testimonial-author and testimonial-company (these are both stored in the postmeta database table).
I would like to use a shortcode to display these on the post page along with the testimonial text.
Can anyone please help me with the code?
add_shortcode('testimonial_author', 'testauth');
function testauth($atts) {
global $post;
return get_post_meta($post->ID,'testimonial-author',true);
}
I used this code instead and it works now: