[Support request] SmartSlider3

Home Forums Support [Support request] SmartSlider3

Home Forums Support SmartSlider3

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #279949
    David

    I’m looking to add a slider to the header of a website, where the slider sits above the primary menu. When adding the short code to the content section (Header add-on), the slider appears below the menu (i.e. the page has a header image, the menu and then the slider). How can I add the slider so it replaces the header image?

    Once this is achieved, I am hoping to add a different header image to the top of each page. For example:

    Page 1 = SmartSlider >> menu
    Page 2 = header image 2 >> menu
    Page 3 = header image 3 >> menu
    etc.

    Probably something simple, but any help will be appreciated.

    Thank you

    #279950
    Leo
    Staff
    Customer Support

    Hi David,

    I think using GP hooks is your best bet here.
    https://docs.generatepress.com/article/hooks-overview/
    http://demo.generatepress.com/hook-locations/

    So in Appearance > GP Hooks > Before Header Content, try something like this:

    <?php if ( is_page( 'home-page-slug' ) ) { ?>
          Slider shortcode here
    <?php } elseif ( is_page( 'page-slug-1' ) ) { ?>
          Image #1
    <?php } elseif ( is_home() ) { ?>
          Image for blog page
    <?php } else { ?>
          Image for all other pages
    <?php } ?>

    Make sure Execute PHP is checked.

    Let me know.

    #280209
    Jasper

    So for all pages except homepage is used this:

    <?php } elseif ( is_home() ) { ?>
    <?php } else { ?>
    [elementor-template id=”74″]
    <?php endif; ?>

    But that does not work, unfortunately

    #280220
    Leo
    Staff
    Customer Support

    Can you answer my question here and stick with one post please.
    https://generatepress.com/forums/topic/after-content-hook-content-only-after-posts/#post-280206

    #280318
    David

    Thank you for the quick reply. I added the following to the ‘Before Header Content’ field and enabled PHP for that option.

    <?php if ( is_page( ‘home-page-slug’ ) ) { ?>
    [smartslider3 slider=2]
    <?php } elseif ( is_page( ‘page-slug-1’ ) ) { ?>
    Image #1
    <?php } elseif ( is_home() ) { ?>
    Image for blog page
    <?php } else { ?>
    Image for all other pages
    <?php } ?>

    Unfortunately, this had the same effect as if I added just the short code to the field. thank you for your help.

    #280374
    Leo
    Staff
    Customer Support

    Hi David,

    You need to replace some contents in the code I provided above in order for it to work. Basically like how you replaced “Slider shortcode here” with “[smartslider3 slider=2]”.
    Without seeing your site I can’t actually give you the code explicitly.

    I edited the code slightly below to help you understand. You need to replace everything in capital letters.
    The assumption here is also that your home page is not the blog page, let me know if this assumption is wrong.

    <?php if ( is_front_page() ) { ?>
          [smartslider3 slider=2]
    <?php } elseif ( is_page( 'PAGE-SLUG-1' ) ) { ?>
          <img src="http://PAGE-1-IMAGE-URL-HERE" />
    <?php } elseif ( is_page( 'PAGE-SLUG-2' ) ) { ?>
          <img src="http://PAGE-2-IMAGE-URL-HERE" />
    <?php } else { ?>
          <img src="http://ALL-OTHER-PAGES-IMAGE-URL" />
    <?php } ?>

    If you still can’t get it to work, it might be easier to show me the site.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.