Add a variable inside a shortcode?
-
Wondering how it might be possible to use a variable inside of a shortcode.
I have a function that returns the current category number to a variable ($mycatid) and I would like to “pass” this number into the shortcode of a plugin I have installed “AZINDEX” in place of the “1” shown below. (somehow substitute $mycatid for the number)My PHP is pretty limited but I understand that the shortcode is seen as a string. Any ideas how I should approach this problem?
‘<?php $mycatid = getCurrentCatID();
echo do_shortcode(‘[az-index id=”1″]’);?>’
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Add a variable inside a shortcode?’ is closed to new replies.