Image slider to display at the very top of home page

enter image description here
Note: The slider only displays if you install the plugin and use the correct slider I.D in the code for the template tag after creating a slider and adding images. The screenshot i posted below proves my code works.

Here’s the header.php code with the template tag for the slider on line 36

<?php
/**
 * The Header for our theme.
 *
 * Displays all of the <head> section and everything up till <div id="content">
 *
 * @package GovPress
 */
?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<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">
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
<!--[if lt IE 9]>
<script src="<?php echo esc_url( get_template_directory_uri() . '/js/html5.js' ); ?>"></script>
<![endif]-->
<?php wp_head(); ?>
</head>

<body <?php body_class(); ?>>
<div id="page" class="hfeed site">

    <?php do_action( 'before' ); ?>

    <nav id="site-navigation" class="main-navigation" role="navigation">
        <div class="col-width">
            <h1 class="menu-toggle"><?php _e( 'Menu', 'govpress' ); ?></h1>
            <a class="skip-link screen-reader-text" href="#content"><?php _e( 'Skip to content', 'govpress' ); ?></a>

            <?php wp_nav_menu( array('theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?>
        </div>
    </nav><!-- #site-navigation -->
<?php if ( is_front_page && function_exists( 'soliloquy' ) ) { soliloquy( 'demo', 'slug' ); } ?>
    <header id="masthead" class="site-header" role="banner">
        <div class="site-branding col-width">
            <?php if ( get_header_image() ) : ?>
                <a href="<?php echo esc_url( home_url( "https://wordpress.stackexchange.com/" ) ); ?>" rel="home">
                    <img src="<?php header_image(); ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="">
                </a>
            <?php endif; // End header image check. ?>
            <h1 class="site-title"><a href="<?php echo esc_url( home_url( "https://wordpress.stackexchange.com/" ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
            <h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
        </div>
    </header><!-- #masthead -->

    <?php if ( is_page_template('templates/home-page.php') ) {
        get_template_part( 'templates/above', 'home-page' );
    } ?>

    <div class="col-width">
        <div id="content" class="site-content">

Assumes you’re using the Soliloquy Lite slider plugin:

<?php if ( is_front_page && function_exists( 'soliloquy' ) ) { soliloquy( 'demo', 'slug' ); } ?>

In the Govpress theme there’s a home-page.php file you might want to paste the template tag for your slider into.

Not sure why the theme Developer doesn’t include a front-page.php or home.php file in the root directory of the theme rather than the way its been structured.

Leave a Comment