Support » Fixing WordPress » Complex do_shortcode statements

  • Resolved johnsalomon


    Hi there,

    I am trying to construct a do_shortcode statement in a PHP code widget, using a custom field. The idea is to get a shortcode evaluated inside a widget.

    The shortcode I’m trying to create is (this is an example)

    [flickrgallery setid=”72157626892022672″]

    I want to use a custom value (called per_post_widget_content) on a per-post basis that lets me enter 72157626892022672 in a field.

    I figure I have to have statements that echo ‘[flickrgallery setid=”‘, then get_post_meta for the custom field value (this part works), then echo ‘”]’

    The do_shortcode statement I have so far is

    <?php global $post do_shortcode(echo ‘[flickrgallery setid=”‘; echo get_post_meta($post->ID, ‘per_post_widget_content’, true); echo ‘”]’;); ?>

    This does not work.

    I’ve tried variations on this, but I can’t get the syntax right – can someone give me a pointer on what I’m doing wrong?

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Complex do_shortcode statements’ is closed to new replies.