0

I need to use a plugin shortcode within a template file, but have one of the variables be set by the value of a custom field in the post. Here's what I have so far. This just breaks the entire page.

My effort (not working):

<?php echo do_shortcode('[wpsp pls_id="get_post_meta($post->ID, 'playlist', true)"]'); ?>

The shortcode:

[wpsp pls_id="NEED VALUE SET HERE"]

The custom field function:

<?php echo get_post_meta($post->ID, 'playlist', true); ?>

Thanks.

1

1 Answer 1

1

Try this:

<?php echo do_shortcode('[wpsp pls_id="' . get_post_meta($post->ID, 'playlist', true) . '"]'); ?>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.