Using shortcodes within the loop
-
Trying to get a button from this plugin working inside the WP loop for post type.
if ( shortcode_exists( 'bs_button' ) ) { echo do_shortcode('[bs_button size="lg" type="default" value="Read More" href=""]'); } else { // fail silently }
This is working well, but how do we get the permalink into that href variable? I’ve tried
echo do_shortcode('[bs_button size="lg" type="default" value="Read More" href="get_permalink();"]');
echo do_shortcode('[bs_button size="lg" type="default" value="Read More" href=" '. get_permalink() .' "]');
But I feel this is the wrong approach. Could it work, or is there another way to make this work?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Using shortcodes within the loop’ is closed to new replies.