I am trying to use this shortcode in my theme and I want the category to become the slug for whatever page it’s on.
<?php echo do_shortcode('[image-carousel category="'.the_slug().'"]'); ?>
Now while this does achieve that function, it is also spitting out the actual text of the slug right above the image. I tried using variables, also tried escaping the quotes, and a bunch of other stuff yet the above script is the only way I’ve gotten it to display the proper image, the only problem is the visible text.
How can I avoid that from happening?
All functions that start with
the_
willecho
its results, and you don’t want that within ado_shortcode()
.Use: