Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1364714
    wbgTHEMECO
    Participant

    How can I add a slider after the masthead on non-wordpress pages like search results or the 404 page (assuming I want to continue using the default 404 page)?

    On pages, I have the meta box where I specify the slider before or after the masthead, but since search results and the 404 page isn’t a “real” page, how can I get the slider on those pages?

    thanks

    #1365376
    Rue Nel
    Moderator

    Hello There,

    Thanks for writing in! What you are trying to accomplish requires a template customization, we would like to suggest that you use a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.

    After the child theme is set up, please add the following code in your child theme’s functions.php file

    // Add custom slider content below the masthead in search and 404 pages
    // =============================================================================
    function custom_content_below_masthead() { ?>
      <?php if ( is_search() || is_404() ) : ?>
        <div class="custom-shortcode">
          <?php echo do_shortcode('[rev_slider alias="slider_alias"]'); ?>
        </div>
      <?php endif; ?>
    <?php }
    //add_action('x_after_view_global__slider-below', 'custom_content_below_masthead');
    // =============================================================================

    or if you want to have separate slider for the search and 404 page, you can use this:

    // Add custom slider content below the masthead in search and 404 pages
    // =============================================================================
    function custom_content_below_masthead() { ?>
      <?php if ( is_search() ) : ?>
        <div class="custom-shortcode">
          <?php echo do_shortcode('[rev_slider alias="search"]'); ?>
        </div>
      <?php else if ( is_404() ) : ?>
          <?php echo do_shortcode('[rev_slider alias="404"]'); ?>
      <?php endif; ?>
    <?php }
    //add_action('x_after_view_global__slider-below', 'custom_content_below_masthead');
    // =============================================================================

    Please make sure that you have inserted the correct slider aliases so that it will work.

    Hope this helps. Kindly let us know.

    #1365934
    wbgTHEMECO
    Participant

    Thanks for the reply.
    I’m not seeing the slider drop in after the header container class masthead.

    On pages, I see this block right after the header container:
    <div class=”x-slider-container below”>
    ..bunch of other code..
    </div>

    #1366038
    wbgTHEMECO
    Participant

    Ah, I see I needed to uncomment the add action line. That’s working now.

    But I did notice a couple of things while I was troubleshooting.

    When the function above was NOT working (because I left the commented line in place), I noticed:

    1) If I activate the Addon for the custom 404 page, the breadcrumb for it shows up as Hello World!.
    2) If I activate the Addon for the custom 404 page, the page options/setting for “Slider Settings Below Masthead” do not activate the slider on the live page, but it shows up in the Cornerstone page builder.

    3) I also noticed that when I did finally realized I needed to uncomment that one line, it worked for the default 404 page but not the Custom 404 page (activated with the add-on).
    4) Ii also noticed that the search page is randomly picking a slider based loosely on my search terms (not the one I specified in the function).

    #1366419
    Rad
    Moderator

    Hi there,

    Will it not really work on custom 404 page because it will replace the 404 page where the above code is assigned. I maybe wrong and I like to check it first.

    Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:

    – Link to your site
    – WordPress Admin username / password
    – FTP credentials

    Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.

  • <script> jQuery(function($){ $("#no-reply-1364714 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>