0

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.

1

1 Answer 1

1

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.'"]');
Sign up to request clarification or add additional context in comments.

3 Comments

thanks for your reply. I tried this: <?php $metaid = 'mslider-id'; echo do_shortcode('[metaslider id="'.$metaid.'"]'); ?> but not working, as it is missing the global $redux_demo. I'm not a pro in php & still learning. so don't know how to make it work.
You need to get the value of mslider-id and then use it with short code to call. I have updated my answer look into that
thanks for your help. yes I missed that part. now it is working fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.