Support » Plugins » Hacks » Echo do_shortcode with variable

  • zecke

    (@zecke)


    Hi

    I got this code:

    <?php $terms = get_the_terms( $post->ID , 'category' );foreach ( $terms as $term ) {$term_link = get_term_link( $term, 'category' ); echo $term_link;} ?>

    That echo me category slug in $term_link variable

    Now I want to put the variable in xxx place:

    <?php echo do_shortcode( '[gallery category="xxx"]' ) ?>

    Can You help me and span those two codes into one properly ?

    Thank You in advance

Viewing 1 replies (of 1 total)
  • J M

    (@hiphopinenglish)

    Can’t you just move the echo $term_link to inside the shortcode?

Viewing 1 replies (of 1 total)
  • The topic ‘Echo do_shortcode with variable’ is closed to new replies.