admin管理员组文章数量:1334328
I am trying to get a carousel slider from the Revolution Slider Addon into the header on the homepage only. And I want it under the header bar (where the menu is). However, the template I'm using doesn't inherently support the slider. So I decided to go into the header.php and input the code myself to put the slider over the top of the default header image. However, when I do this, it also puts the slider in the header on the blogs post page. It doesn't appear anywhere else on the site besides the home (desired) and the blogs post page (undesired).
Is there a way to restrict this code to ONLY the website homepage and not appearing in the header anywhere else? Maybe some kind of if-conditional?
Here is the code section where I put the slider in header.php:
<!-- Mobile Menu -->
</div>
<div class="header-fix-wrapper">
<header class="clearfix<?php if($sonus_opt['podcast-mode'] == 1){ if(!is_home()){ if(is_single()){ if($this_is_podcast == 1){echo " single-header";} }elseif(is_front_page()){echo " home-header"; }}} ?>">
<div class="header-bar">
<!-- Head Bar -->
<?php add_revslider('funky-slider','homepage'); ?>
</div>
</header>
</div>
</div>
I am trying to get a carousel slider from the Revolution Slider Addon into the header on the homepage only. And I want it under the header bar (where the menu is). However, the template I'm using doesn't inherently support the slider. So I decided to go into the header.php and input the code myself to put the slider over the top of the default header image. However, when I do this, it also puts the slider in the header on the blogs post page. It doesn't appear anywhere else on the site besides the home (desired) and the blogs post page (undesired).
Is there a way to restrict this code to ONLY the website homepage and not appearing in the header anywhere else? Maybe some kind of if-conditional?
Here is the code section where I put the slider in header.php:
<!-- Mobile Menu -->
</div>
<div class="header-fix-wrapper">
<header class="clearfix<?php if($sonus_opt['podcast-mode'] == 1){ if(!is_home()){ if(is_single()){ if($this_is_podcast == 1){echo " single-header";} }elseif(is_front_page()){echo " home-header"; }}} ?>">
<div class="header-bar">
<!-- Head Bar -->
<?php add_revslider('funky-slider','homepage'); ?>
</div>
</header>
</div>
</div>
Share
Improve this question
asked Jun 7, 2020 at 23:21
KadeKade
1
1 Answer
Reset to default 0you can conditionally display it only in front page by is_front_page()
reference: https://developer.wordpress/reference/functions/is_front_page/
Try:
if (is_front_page()) {
add_revslider('funky-slider','homepage');
};
本文标签: How do I get the Revolution Slider in the header on the homepagebut not the blog index page
版权声明:本文标题:How do I get the Revolution Slider in the header on the homepage, but not the blog index page? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742368143a2461703.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论