BuddyBoss Home – Web › Support Forums › Themes › BuddyBoss theme › Smaller version of slider in header?
Tagged: front page, header, slider
- This topic has 15 replies, 2 contibutors, and was last updated 9 years, 11 months ago by
FoxdenVixen.
Question
March 10, 2015 at 12:06 pm #37117@foxdenvixenHere is an interesting question. What if I wanted to take the slider code out of the front-page.php and put it in the header.php page with the slider being much smaller and to the right of the logo? Is this possible? Plus I would want to turn it completely off in the mobile pages. I do realize that I need to make a copy of both pages in the parent theme and add them to the child theme. Then do my changes.
Answers
March 12, 2015 at 8:44 pm #37238@alyssa-buddyboss
AlyssaParticipant@foxdenvixen no problem. The slider code is right there in the front-page code. If you want it to have a max/fixed width I’d encapsulate the code with a unique div class. The just add code via CSS to hide the div on mobile.
March 13, 2015 at 9:31 am #37257@foxdenvixenThank you TJ. I will play around with this to see if I can get it to work.
April 1, 2015 at 2:40 pm #38386@foxdenvixenThis is the code that I found in front-page.php. I wrapped a div around it but have not styled it yet. When I add the code to the header right under the logo section, it messes up the navigation. Could this be because I have not styled it yet and have not activated the slides? WP can get confusing with all the different pages that control different aspects of the site. I might need help understanding where to put the code and how to style it so that it is small and to the right of the logo in the header.
<!-- Frontpage Slider --> <div class="header_slider". <?php get_template_part( 'content', 'slides' ); ?> </div>
April 2, 2015 at 9:16 am #38411@alyssa-buddyboss
AlyssaParticipant@foxdenvixen yes, it is like that because you have not styled it yet. But it also might be difficult to add to certain areas of the site depending on the responsiveness of the theme. Start out by sizing it to 200px or whatever you want. Then worry about moving other elements and trying to make it fit where you want it.
April 6, 2015 at 7:36 am #38555@foxdenvixenThanks, @tjchester. I will play around with this. If I need more help, I will post here.
April 6, 2015 at 8:13 am #38557@foxdenvixenYay got this to work and it looks good. Had to re-style the logon part but it works.
April 6, 2015 at 8:27 am #38559@foxdenvixenThere is one more question here….how do I set the header to only have the slider on the home page?
April 6, 2015 at 1:34 pm #38575@alyssa-buddyboss
AlyssaParticipant@foxdenvixen you will need to put it in this if statement to only appear on the front page:
if ( is_front_page() && is_home() ) {}
April 6, 2015 at 2:34 pm #38579@foxdenvixenIf I am using the default fwslider, do I use that between the brackets?
April 6, 2015 at 2:45 pm #38580@foxdenvixenTried this but getting a syntax and parse error. No real PHP knowledge here. Please help with the exact code. Thanks.
<?php if ( is_front_page() && is_home() ) {fwslider}; ?>
April 6, 2015 at 7:43 pm #38584@alyssa-buddyboss
AlyssaParticipant@foxdenvixen might be beneficial to learn it with all this WordPress work 😉
Encapsulate your current code like you posted above but also encapsulated your own div for styling:if ( is_front_page() && is_home() ) { ?> <!-- Frontpage Slider --> <div class="header_slider"> <?php get_template_part( 'content', 'slides' ); ?> </div> <?php } ?>
April 6, 2015 at 10:36 pm #38592@foxdenvixen@tjchester, I know that I should learn PHP but I really don’t have the time to stop working for my client to take a few weeks to learn it.
This is what I put and now the slider is gone –
<?php if ( is_front_page() && is_home() ) { ?> <!-- Frontpage Slider --> <div class="header_slider"> <?php get_template_part( 'content', 'slides' ); ?> </div> <?php } ?>
I am using the default fwslider. The styling for it uses div id not div class. When I do an inspect element in Chrome it is #fwslider. I tried changing the CSS to match “header_slider” but that didn’t work either. I have googled how to do what I am wanting to do by having the slider only on the home page in the header and have found all sorts of different coding. All of them had the name of the actual slider being used in the code. I just want to make sure I am doing this correctly for THIS theme.
Some examples of code that I found are –
<?php if ( is_home() && function_exists('easingsliderlite') ) { easingsliderlite(); } ?>
another example –
<?php if( is_front_page() AND function_exists('easing_slider')) { easing_slider(); } ?>
I know every theme is different. Please be patient with me.
April 7, 2015 at 6:45 am #38600@foxdenvixenForgot to add how I styled it –
#fwslider { float: right; width: 500px; margin-right: 200px; position: relative; overflow: hidden; background-color: #000000; background: rgba(0,0,0,0.8); box-shadow: #030303 4px 4px 4px; } #fwslider .timer { height: 4px; width: 40px; background-color: #000; float: left; margin-right: 10px; display: none; }
I turned the timer styling off and added a drop shadow to the slider.
April 7, 2015 at 11:38 am #38620@alyssa-buddyboss
AlyssaParticipant@foxdenvixen try this instead:
if ( is_front_page() ) { ?> <!-- Frontpage Slider --> <div class="header_slider"> <?php get_template_part( 'content', 'slides' ); ?> </div> <?php } ?>
- The question ‘Smaller version of slider in header?’ is closed to new replies.