Slider only on front page
-
SOS!
How do I only set my slider on the front page? I have a purchased themed that came with a slider so I disabled it. I went into the themes header.php and inserted the sliders php “<?php wd_slider(2); ?>” at the bottom of the themes header code. The slider appears on every page header on the website. I have attached the themes header.php which includes the sliders php at the bottom.<!DOCTYPE html>
<html <?php language_attributes(); ?>><!– start deea head here –>
<head>
<?php global $data; ?>
<meta charset=”<?php bloginfo( ‘charset’ ); ?>”>
<meta http-equiv=”X-UA-Compatible” content=”IE=edge”>
<meta name=”viewport” content=”width=device-width, initial-scale=1″><title><?php wp_title( ‘-‘, true, ‘right’ ); ?></title>
<link rel=”profile” href=”http://gmpg.org/xfn/11″ />
<?php if($data[‘deea_favicon’]): ?>
<link rel=”shortcut icon” href=”<?php echo $data[‘deea_favicon’]; ?>” type=”image/x-icon” />
<?php endif; ?><link rel=”alternate” type=”application/rss+xml” title=”<?php bloginfo(‘name’); ?> RSS Feed” href=”<?php bloginfo(‘rss2_url’); ?>” />
<link rel=”alternate” type=”application/atom+xml” title=”<?php bloginfo(‘name’); ?> Atom Feed” href=”<?php bloginfo(‘atom_url’); ?>” />
<link rel=”pingback” href=”<?php bloginfo( ‘pingback_url’ ); ?>” />
<?php wp_head(); ?>
</head><body <?php body_class(); ?>>
<!– start deea header here –>
<div id=”menu-top-bar”>
<!– start deea navigation here –>
<div id=”nav-wrapper”>
<?php wp_nav_menu( array( ‘container’ => false, ‘theme_location’ => ‘main-menu’, ‘menu_class’ => ‘menu’ ) ); ?>
</div><!– start deea search here –>
<?php if ( $data[‘deea_top_search’] == ‘1’):?>
<div id=”search-icon”></div>
<div id=”search-box-wrap”>
<div id=”search-box”>
<?php get_search_form(); ?>
</div>
</div>
<?php endif; ?>
<!– start deea social icons here –>
<?php if ( $data[‘deea_social_media’] == ‘1’):?>
<div id=”social-bar-top” <?php if ( $data[‘deea_top_search’] == ‘0’):?>class=”nosearch”<?php endif; ?>><?php if($data[‘deea_facebook’]): ?>” target=”_blank”><i class=”fa fa-facebook fa-2x”></i><?php endif; ?>
<?php if($data[‘deea_twitter’]): ?>” target=”_blank”><i class=”fa fa-twitter fa-2x”></i><?php endif; ?>
<?php if($data[‘deea_linkedin’]): ?>” target=”_blank”><i class=”fa fa-linkedin fa-2x”></i><?php endif; ?>
<?php if($data[‘deea_instagram’]): ?>” target=”_blank”><i class=”fa fa-instagram fa-2x”></i><?php endif; ?>
<?php if($data[‘deea_pinterest’]): ?>” target=”_blank”><i class=”fa fa-pinterest fa-2x”></i><?php endif; ?>
<?php if($data[‘deea_plus’]): ?>” target=”_blank”><i class=”fa fa-google-plus fa-2x”></i><?php endif; ?>
<?php if($data[‘deea_youtube’]): ?>” target=”_blank”><i class=”fa fa-youtube-play fa-2x”></i><?php endif; ?>
<?php if($data[‘deea_vimeo’]): ?>” target=”_blank”><i class=”fa fa-vimeo-square fa-2x”></i><?php endif; ?>
<?php if($data[‘deea_rss’]): ?>” target=”_blank”><i class=”fa fa-rss fa-2x”></i><?php endif; ?></div>
<?php endif; ?>
<div class=”menu-mobile”></div></div>
<br><br>
<header id=”header”>
<div class=”container”>
<!– start deea logo here –>
<div id=”logo”>
<?php if ( $data[‘deea_logo’ ]) : ?>
<h1>” title=”<?php echo esc_attr( get_bloginfo( ‘name’, ‘display’ ) ); ?>” rel=”home”>” alt=”<?php echo esc_attr( get_bloginfo( ‘name’, ‘display’ ) ); ?>” /></h1>
<?php else : ?>
<h1>” title=”<?php echo esc_attr( get_bloginfo( ‘name’, ‘display’ ) ); ?>” rel=”home”><?php bloginfo( ‘name’ ); ?></h1>
<?php endif; ?>
</div><?php wd_slider(2); ?>
</div></header>
The page I need help with: [log in to see the link]
-
Hey, @surferbum94!
Thank you for posting about this!
Could you please add the code of your slideshow in the following if statement?
if (is_front_page() || is_home())This will trigger Slider WD functions to execute only on the homepage of your website. Let us know if this helps.
Thanks! Have a great day!
So you want me to add the slider code: “<?php wd_slider(2); ?> inside of ” if (is_front_page() || is_home()) ” ? Where do I put it?
Hi, @surferbum94!
Simply replace the previous
<?php wd_slider(2); ?>code in header.php, where you have it now, with the following:if (is_front_page() || is_home()) { <?php wd_slider(2); ?> }Make sure to clear the cache of your web browser after making these changes.
Cheers!Thank you!
-
This reply was modified 8 years, 8 months ago by
surferbum94.
Hi, @surferbum94!
You are most welcome! We are happy to know it worked.
We hope you can spread the word and tell your friends about Slider WD. If you have time, please share your thoughts about the plugin here:
https://wordpress.org/support/plugin/slider-wd/reviews/
Thank you so much! Have a great day!
P.S. I posted an incorrect code before, you need to use the following instead:
<?php if (is_front_page() || is_home()) { wd_slider(2); } ?> -
This reply was modified 8 years, 8 months ago by
The topic ‘Slider only on front page’ is closed to new replies.