Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

From what I've seen there is common for a theme developer to make multiple slider plugins available in a theme.

I intend to add the capability of including a slider on the home page of my theme. I find it quite difficult to find a general way of including one slider so that the user can change it with another one if he wishes to.

Say that the user has 3 available sliders he can choose from: x, y and z In my Theme Settings Page I have a simple Radio option "Enable / Disable slider"; If the slider is enabled I have to find out what slider (x, y or z) the user wishes to display on the home page and display it accordingly.

Now, with only my custom slider implementation the things are pretty simple.

functions.php

global $customSlider;
$customSlider = new CustomSlider();

header.php

<?php if (user_wants_slider()) : ?>
   <?php $customSlider->renderSlider()?> //renderSlider echoes the HTML code
<?endif ?>

I imagine this is a wrong approach considering that it would be difficult to implement the Nivo Slider in the header.php if the user would choose that instead. Is there any good practice for this problem? Thanks!

share|improve this question
1  
I am sorry to say so - and I can of course only speak for myself - but I do not grasp what it exactly is you're asking... – Johannes Pille Mar 12 at 15:55
I usually just run a check against the saved options. I do this in my functions that render the sliders and that enqueue the scripts for the different sliders. That way in your theme all you have to do is call one function for the different mark up required for each slider. – Jacob Rambo Mar 12 at 16:07

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.