How to write vars into shortcode
-
I have a need to find the category id of a post and then use that to display a gallery using shortcode. The plugin author only has shortcode so I have to use that. I have the id I need by using
<?php $firstCategory = $categories[2]->term_id; echo $firstCategory; ?>
Which returns a number for the category.I need to get that into my shortcode like:
<?php echo do_shortcode( '[post-slides cat_id=$firstCategory]' ); ?>
I don’t know how to write it though. In Javascript it would be something like id=” + firtCategory +”….Help! ??
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How to write vars into shortcode’ is closed to new replies.