Reputation:
Here's what I'd like to do. This function which grabs the content of a custom Wordpress post field:
get_post_meta($post->ID, 'society_twitter', true);
Needs to run in place of the string 'yourTwitterUsername' below,
[twitter-widget username="yourTwitterUsername"]
Looking something like:
[twitter-widget username="get_post_meta($post->ID, 'society_twitter', true);"]
Is this possible? If so, what is the syntax? A little more detail: I'm trying to modify a Twitter widget to display the username listed in a custom post field in my database rather than just one string value. I've tried editing the plugin php itself but this seems like an easier solution.
Upvotes: 0
Views: 949
Reputation: 59699
Use string concatenation?
$string = '[twitter-widget username="' . get_post_meta($post->ID, 'society_twitter', true) . '"]';
Edit: Updated based on the comments:
$string = '[twitter-widget username="' . get_post_meta($post->ID, 'society_twitter', true) . '"]';
echo do_shortcode( $string);
Upvotes: 3