Home › Forums › Trusted Pro › Header Image
- This topic has 13 replies, 3 voices, and was last updated 7 years, 2 months ago by Andy.
-
AuthorPosts
-
October 20, 2017 at 12:11 pm #2363pqsysParticipant
Is there a way to replace the header image with a slider?
October 20, 2017 at 2:02 pm #2364YazminKeymasterSorry, no, the theme does not have a slider.
October 20, 2017 at 2:05 pm #2366pqsysParticipantIs there any way to modify it to replace the header image with a slider? Would it support such a change?
October 20, 2017 at 4:20 pm #2367AndyKeymasterIt 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.
October 20, 2017 at 6:22 pm #2371pqsysParticipantWould it be possible to use “<?php putRevSlider(‘Featured Posts’, ‘homepage’); ?>” or “<?php putRevSlider( ‘Featured Posts’ ); ?>” ?
October 20, 2017 at 6:53 pm #2372AndyKeymasterYes it should be OK. It looks like
putRevSlider()
is Revolution Slider’s built-in function that does similar job to the WordPressdo_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(); } }
October 20, 2017 at 7:06 pm #2374pqsysParticipantI replaced the code but it did not work.
October 20, 2017 at 7:31 pm #2376pqsysParticipantPlacing <?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.
October 20, 2017 at 8:30 pm #2379AndyKeymasterOK, change
is_home()
tois_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.
October 20, 2017 at 8:33 pm #2380pqsysParticipantYes, I do see “testing: some text here” on the home page.
October 20, 2017 at 9:13 pm #2382AndyKeymasterOK, 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(); } }
October 20, 2017 at 9:17 pm #2383pqsysParticipantThe Slider is displayed! Thank you very much!!! 🙂
October 23, 2017 at 8:07 pm #2407pqsysParticipantFor 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)
October 24, 2017 at 9:58 am #2408AndyKeymasterTo 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; }
-
AuthorPosts
- The topic ‘Header Image’ is closed to new replies.