Support » Plugin: Promotion Slider » [Plugin: Promotion Slider] Slider in hard code, need different slider on each page

  • Resolved sberman


    Hi! I want the slider to be above the post/page content area, not inside it, so I hardcoded it into my php page template like this:

    <?php echo do_shortcode(‘[promoslider category=”home” width=”993px” height=”235px”]’); ?>

    just above

    <div id=”primary” class=”subpage-alt”>
    <div id=”content” role=”main”>


    Now it’s in the correct place, but the slider is the same on every page. I need the slider to be different on every page. How do I do that?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Micah Wood


    You would have to use PHP to detect the current context of the page and pass a different shortcode to the do_shortcode() function.

    For example:

    if( is_home() ) {
        echo do_shortcode('[promoslider category="home" width="993px" height="235px"]');
    } else if ( is_page() ) {
        echo do_shortcode('[promoslider category="page" width="993px" height="235px"]');

    The code above would show one slider for the blog page and another for regular pages. Beyond that, it wouldn’t show at all. You would just create a ‘home’ and ‘page’ category and assign your desired promotions to each category.

    Thank you. Would I place this inside my page Template.php file?

    And if I want different sliders on different pages, do I just create a category for each page? Or do I have to create a new Template.php for each page to use?

    Like this?

    if( is_home() ) {
    echo do_shortcode(‘[promoslider category=”home” width=”993px” height=”235px”]’);
    } else if ( is_welcome() ) {
    echo do_shortcode(‘[promoslider category=”welcome” width=”993px” height=”235px”]’);
    } else if ( is_events() ) {
    echo do_shortcode(‘[promoslider category=”events” width=”993px” height=”235px”]’);

    I am new to WordPress so please forgive my confusion.

    Plugin Author Micah Wood


    The template itself is only used in certain contexts. It would depend on where you want the code to appear, which template files are used and in which contexts.

    Here are two links that would hopefully make this a bit more clear:

    So instead of hard-coding the slider, if I go back to putting it on each page/post with [pomoslider] in the post area, it can be a different slider on each page. This is truly what I want.

    But if I do that, the slider is not in the correct location. I don’t want it to be INSIDE a post, but above it. And I want it to be the width of the entire page, not the width of the post content area.

    Do you have any suggestions for making it work this way? I appreciate your help!

    Plugin Author Micah Wood


    Personally, I would probably place the code in the theme template files. Unfortunately, without knowing which theme / template files you have and exactly what the contexts are that you want to display the slider in, I can’t really help out much with specifics.

    I am using Twenty-Eleven with a child Theme where I created new style.css and subpage.php files.

    Per your suggestion I will try the Template route. Right now all my pages are using the same subpage.php Template file except for the Blog page. I’ll just have to make a different Template for each page I guess.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Promotion Slider] Slider in hard code, need different slider on each page’ is closed to new replies.