Home Forums Trusted Pro Header Image

  • This topic has 13 replies, 3 voices, and was last updated 7 years ago by Andy.
Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #2363
    pqsys
    Participant

    Is there a way to replace the header image with a slider?

    #2364
    Yazmin
    Keymaster

    Sorry, no, the theme does not have a slider.

    #2366
    pqsys
    Participant

    Is there any way to modify it to replace the header image with a slider? Would it support such a change?

    #2367
    Andy
    Keymaster

    It is possible using a slider plugin. You would need some php knowledge.
    You could copy the header.php file to a child theme and change it to display the content from a slider plugin.

    For example, in the header.php file there is the trusted_header_title() function which prints out the header image/title/excerpt etc, and you could make changes so that it displays a slider instead based on certain conditions.

    e.g. to show slider only on home page:

    if ( is_home() ) {
        echo do_shortcode( '[slider-plugin-shortcode]' );
    } else {
        trusted_header_title();
    }

    replacing slider-plugin-shortcode with the actual shortcode for whatever plugin you use.

    #2371
    pqsys
    Participant

    Would it be possible to use “<?php putRevSlider(‘Featured Posts’, ‘homepage’); ?>” or “<?php putRevSlider( ‘Featured Posts’ ); ?>” ?

    #2372
    Andy
    Keymaster

    Yes it should be OK. It looks like putRevSlider() is Revolution Slider’s built-in function that does similar job to the WordPress do_shortcode() function.

    In the code I gave earlier, I forgot about the blank canvas template condtitonal, so the code to use should be this:

    Replace this code in header.php file:

    if ( ! is_page_template( 'template-blank-canvas.php' ) ) {
    	trusted_header_title();
    }

    with this code:

    if ( ! is_page_template( 'template-blank-canvas.php' ) ) {
        if ( is_home() ) {
            putRevSlider( 'Featured Posts' );  
        } else {
            trusted_header_title();
        }
    }
    #2374
    pqsys
    Participant

    I replaced the code but it did not work.

    #2376
    pqsys
    Participant

    Placing <?php putRevSlider( ‘Featured Posts’ ); ?> in the Header.php file does work, to a point. The slider will show up on the page, just not where I want it to be.

    #2379
    Andy
    Keymaster

    OK, change is_home() to is_front_page() and try this:

    if ( ! is_page_template( 'template-blank-canvas.php' ) ) {
        if ( is_front_page() ) {
            echo '<header class="main-header" style="height: 500px;">
            <p>testing: some text here</p>
            </header>
            <div class="container clearfix">';
        } else {
            trusted_header_title();
        }
    }

    and let me know if you see testing: some text here on the home page.

    #2380
    pqsys
    Participant

    Yes, I do see “testing: some text here” on the home page.

    #2382
    Andy
    Keymaster

    OK, change that code for this and let me know if the slider is displayed

    if ( ! is_page_template( 'template-blank-canvas.php' ) ) {
        if ( is_front_page() ) {
            echo '<header class="main-header">';
            putRevSlider( 'Featured Posts' );
            echo'</header>
            <div class="container clearfix">';
        } else {
            trusted_header_title();
        }
    }
    #2383
    pqsys
    Participant

    The Slider is displayed! Thank you very much!!! 🙂

    #2407
    pqsys
    Participant

    For some reason the header image is still showing behind the slider. Can the header image on the homepage be completely removed or re-sized? (only on the homepage)

    #2408
    Andy
    Keymaster

    To remove the header background image on the homepage add this to Additional CSS (or in your child theme’s style.css):

    .home .main-header {
        background-image: none;
    }
Viewing 14 posts - 1 through 14 (of 14 total)
  • The topic ‘Header Image’ is closed to new replies.