WordPress.org

Ready to get started?Download WordPress

Forums

header to show on the home page only -Twenty Twelve (customized header) (7 posts)

  1. hoahonggiay
    Member
    Posted 1 year ago #

    So i think this is really easy to do to make the header only show in the home page.
    existing line:

    if ( ! empty( $header_image ) ) : ?>

    after the edit:

    if ( ! empty( $header_image ) && is_home() ) : ?>

    BUT
    I customized my header and using a slider plugin. its like this:

    <?php if ( function_exists( 'meteor_slideshow' ) ) { meteor_slideshow(); } ?>

    so what should i change it to? please help !

  2. paulwpxp
    Font hero
    Posted 1 year ago #

    Replace this 4 lines block #L48 to #L51 (link for reference)
    http://themes.trac.wordpress.org/browser/twentytwelve/1.2/header.php

    With

    <div class="myslider">
    	<?php if ( function_exists( 'meteor_slideshow' ) ) { meteor_slideshow(); } ?>
    </div>

    The div is optional, might not needed.

    In case, your front page is set to a page. There is no need to edit any template at all, just place the shortcode at the topmost area of that page content.

  3. sharadchhetri
    Member
    Posted 1 year ago #

    Check if the plugin is providing the shortcode.
    I implemented the short code in my blog also.
    I have written about this How To.
    http://sharadchhetri.com/2013/06/08/how-to-put-slider-shortcode-only-in-home-page-in-wordpress/

    For live example.You can see my home page of my blog,I am still using it

  4. try:

    <?php if ( function_exists( 'meteor_slideshow' ) && is_home() ) { meteor_slideshow(); } ?>

    if this doea not work, please post the full code of header.php (please use the pastebin as described in http://codex.wordpress.org/Forum_Welcome#Posting_Code )

  5. hoahonggiay
    Member
    Posted 1 year ago #

    Thank you all. so helpful my heroes :)
    @paulwpxp: so i remove the whole header (which the code from #L48 to #L51 ) and after that copy the code of the Slider plugin to the Home page (i set a static home page from a page).
    @alchymyth: i did try your solution first and it didnt work. but I'm quite curious how to fix this in the header.php so i would like to put my full header code here:
    http://pastebin.com/qXVGasZd
    @sharadchhetri: im really new with coding..im not sure i understand your solution. Thank so much tho

  6. are you using a static front page?

    in this case, use is_front_page() instead of is_home();

    <?php if ( function_exists( 'meteor_slideshow' ) && is_front_page() ) { meteor_slideshow(); } ?>

    http://codex.wordpress.org/Conditional_Tags

  7. hoahonggiay
    Member
    Posted 1 year ago #

    Thanks alchymyth so much...

Topic Closed

This topic has been closed to new replies.

About this Topic