This code enables you to install the Soliloquy slider to the header of the Twenty Sixteen child theme for WordPress like this:
The code includes a conditional tag so the slider only displays on the first page of the front page archive and not on any paginated pages.
The video shows you how to install the code which displays the slider in your header template.
There’s 3 simple steps you need to take to add the slider.
- Make sure the Twenty Sixteen parent theme is installed and then install a child theme for Twenty Sixteen.
- Copy over the the header.php file from the Twenty Sixteen parent theme to the child themes root directory.
- Using FTP and a code editor, add the following PHP code to the header.php in the child theme.
Note: You will need to add a new slider and configure the slider settings after installing the Soliloquy plugin. Once you do that, you can then swap out the slider i.d in the codes template tag with whatever your slider generates like this:
The position you place the code in the header.php file determines where the slider displays.
The display the slider after the title and before the navigation menu, add the code immediately after the closing div for the
.site-branding class on line 42 like this:
If you want to display your slider on all front page or home paginated pages, remove the following from the code:
|| get_query_var( 'paged' ) >= 2
If you want to display the slider sitewide, remove the following from the code:
if ( ! is_front_page() || get_query_var( 'paged' ) >= 2 ) return;
Thats all there is to it!
Download Child Theme
The following child theme for Twenty Sixteen includes the code from this tutorial already installed in the header.php file. Simply upload and activate.