The name of the function for the pro version of the Easing Slider plugin is different to the free version so the code for installing the free version won’t work with the pro version. You can follow the tutorial about how to install the free ‘Lite’ version here.
In this tutorial, you’ll learn how to install the slider:
1. Using a custom function for themes which use hooks
2. In the header template file of any theme which doesn’t use hooks
Firstly, here’s the code to install the Pro version on your home or front page of a StudioPress child theme.
Home Page Before The Loop
add_action('genesis_before_loop', 'display_slider_before_posts_home');
function display_slider_before_posts_home() {
if (is_home() && function_exists('easingsliderpro') ) {
easingsliderpro( 1 );
}
}
The above code displays the slider before the blog posts on the home page.
Home Page After The Header
add_action('genesis_after_header', 'display_slider_before_posts_home');
function display_slider_before_posts_home() {
if (is_home() && function_exists('easingsliderpro') ) {
easingsliderpro( 1 );
}
}
The code above adds the slider after the header on the home page only.
Home Page In The Header
add_action('genesis_header', 'display_slider_before_posts_home');
function display_slider_before_posts_home() {
if (is_home() && function_exists('easingsliderpro') ) {
easingsliderpro( 1 );
}
}
The PHP code above displays the slider in the header on the home page only.
Using Static Page As Home Page
If you have created a custom home page and selected it to display on your front page using the WordPress Reading Settings, you’ll need to change the conditional tag in the code from:
is_home() to is_front_page()
Here’s an example after changing the conditional tag:
add_action('genesis_header', 'display_slider_before_posts_home');
function display_slider_before_posts_home() {
if (is_front_page() && function_exists('easingsliderpro') ) {
easingsliderpro( 1 );
}
}
Another option is to include the conditional tag for the home page and front page in the same function.
This way your slider will display on the home or front page regardless of your reading settings configuration.
Here’s an example after adding both conditional tags:
add_action('genesis_header', 'display_slider_before_posts_home');
function display_slider_before_posts_home() {
if ( is_home() || is_front_page() && function_exists('easingsliderpro') ) {
easingsliderpro( 1 );
}
}
Install Slider In Header Template File
If you’re using a theme which doesn’t includes hooks, you’ll need to add the slider function to a template file preferably in a child theme of the parent. This way it won’t be lost if you update the parent themes files at some stage down the track.
You can simply copy the header.php file to your child theme and add the code to it there.
There’s at least 3 different code snippets you can use to display a slider on the home or front page.
Default Home Page
Open the header.php file and paste the code in the position you want the slider to display.
The above code only works when you have selected Front page displays > Your latest posts in the Reading Settings page of WordPress.
Custom Page As Front Page
This code only works when you have selected Front page displays > A static page in the Reading Settings page of WordPress.
Default Home or Custom Page As Front Page
This code works when you have selected Front page displays > A static page or Your latest posts in the Reading Settings page of WordPress.
Reading Settings Screenshot
Filters & Hooks for Developers
Easing Slider contains multiple hooks and filters for extending the PHP side of the plugin, both front-end and administrative as well as altering core values throughout the plugin.
Install Free Version
Simply replace the slider I.D (12345) in the following code.
add_action( 'genesis_after_header', 'slider' );
function slider() {
if ( function_exists( 'easingslider' ) ) {
easingslider(12345);
}}
Was This Tutorial Helpful?