Reputation: 191
I'm using redux frmaework for my theme option panel. & I'm using meta slider for my homepage. I used this shortcode in my frontpage template to show the slider:
<?php echo do_shortcode('[metaslider id=21]'); ?>
but I want to change the id from my option panel, so I don't have to edit my template each time I replaced the slider with a new one. I've created a field for that in my redux config page. Now I can use this code:
<?php echo $redux_demo['mslider-id']; ?>
but I don't know how can I add this to my first code. I want to replace the id number "21", with this 2nd code.
Upvotes: 0
Views: 980
Reputation: 8809
first you need to get the value from option table like this
$metaid = get_option('mslider-id'); //get the value of mslider which saves from admin.
echo do_shortcode('[metaslider id="'.$var.'"]');
Upvotes: 1