Adding an image slider in the header of my site

I am new to WordPress. Can you please suggest the steps to insert an image slider in my site’s header? I don’t know how to insert the code or where.

5 Answers
5

Depends on what theme you are using because some include hooks which make the job easier.

For themes which don’t include hooks like Twenty Eleven & Twenty Twelve, you can simply past the PHP tag for the slider into the header.php file in the position you want your slider to display.

Example if using the free version of Soliloquy:

    <?php if ( function_exists( 'soliloquy_slider' ) ) soliloquy_slider( '007' ); ?>

Simply replace the 007 with the i.d for your slider which is generated once you create a new slide show.

If you only want to display your slider on the front page, add a conditional tag to the code like this:

   <?php if ( is_front_page() && function_exists( 'soliloquy_slider' ) ) soliloquy_slider( '007' ); ?>

Note: You should copy your parent themes header.php file to a child theme before adding the code for the slider otherwise you may lose it if you update the parent theme.

If your theme includes hooks, then you can add a custom function in your child themes functions.php file like this:

    function soliloquy_slider_header() {
    if ( function_exists( 'soliloquy_slider' ) ) soliloquy_slider( '007' );
    };
    add_action('your_header_hook', 'soliloquy_slider_header');

Source: http://wpsites.net/best-plugins/add-soliloquy-slider-in-header-of-any-theme/

Leave a Comment