WordPress.org

Ready to get started?Download WordPress

Forums

Echo do_shortcode with variable (2 posts)

  1. zecke
    Member
    Posted 8 months ago #

    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

  2. hiphopinenglish
    Member
    Posted 8 months ago #

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

Reply

You must log in to post.

About this Topic

Tags

No tags yet.