How to hide breadcrumb on home page only?

  • raindance

    #1761

    Hi

    Can someone tell me please how to hide the breadcrumb on the home page only?

    http://juicytravels.com/

    See the Home > 1 in the grey box under the slider? I don’t want the grey box or the breadcrumb there, but I do want the breadcrumbs as they are on the interior pages.

    Thanks in advance!

    Laura

    Jon Lynch

    #17100

    This is something that I wanted to sort out for my site. Here is the code I added to my functions.php:

    /******
    * these next two remove the graphene breadcrumb and then add one
    * which does not appear on the home page
    *****/

    // has to be called after the action is added
    add_action ('after_setup_theme', 'wmrt_remove_graphene_bc');
    function wmrt_remove_graphene_bc() {
    remove_action ('graphene_top_content', 'graphene_breadcrumb_navxt');
    }

    add_action('graphene_top_content', 'wmrt_breadcrumb_navxt');
    function wmrt_breadcrumb_navxt () {
    //by calling this at this point is_home() works!
    if ((function_exists('bcn_display')) && (!(is_home()))) {
    echo '<div class="breadcrumb">';
    bcn_display();
    echo '</div>';
    }
    }

    raindance

    #17101

    Didn’t work for me…

    Caused all kinds of weirdness. Maybe conflicted with a plug in or something.

    Jon Lynch

    #17102

    Are you using Breadcrumb NavXT for your breadcrumbs?

    Jon Lynch

    #17103

    sorry, you may also need php tags around it. Put <?php in front of the block and ?> after the block

    raindance

    #17104

    Yup…using Breadcrumb NavXT.

    Are you using that also?

    Looking to see if there is an option there to not show on home page but not finding…

    raindance

    #17105

    Hey that did it…thank you so much for sharing! Just needed to add the tags.

    I should have known to put the php tags, duh.

    Perfect now, thank you!

    raindance

    #17106

    I haven’t logged in for awhile and I just went to log in and I get this error:

    Warning: Cannot modify header information – headers already sent by (output started at /home/juicytrv/public_html/wp-content/themes/graphene-child/functions.php:37) in /home/juicytrv/public_html/wp-includes/pluggable.php on line 934

    Line 37 is where I added that new breadrumb text we worked on. I’m not sure I logged in since, I think not. If I remove it, I still can’t log in. Any ideas? I’m totally stuck and of course sitting down to work for the day but can’t get in…any help much appreciated!

    raindance

    #17107

    Oh, and here is my child functions.php file if that helps. Did I put the php tags in the wrong place or way or something?

    <?php
    function graphene_slider_post_types(){
    return array('post', 'page');
    }
    add_filter( 'graphene_slider_post_type', 'graphene_slider_post_types' );
    ?>
    <?php
    // attaches the function my_post_nav to the hook graphene_post_nav
    add_action ('graphene_after_post_content', 'my_post_nav');

    // our function
    function my_post_nav(){

    // this will allow us to use other hooks but still only show on single posts
    if ( is_single() && ! is_page() ) : ?>
    <div id="my-post-nav"> <!-- div to contain your links -->
    <?php previous_post_link_plus( array(
    'order_by' => 'menu_order',
    'loop' => false,
    'max_length' => 0,
    'tooltip' => 'Previous page',
    'in_same_cat' => true,
    'ex_cats' => '12'
    ) );?> |
    <?php next_post_link_plus( array(
    'order_by' => 'menu_order',
    'loop' => false,
    'max_length' => 0,
    'tooltip' => 'Next page',
    'in_same_cat' => true,
    'ex_cats' => '12'
    ) );?>
    </div>
    <?php endif; ?>
    <?php } ?>

    <?php
    /******
    * these next two remove the graphene breadcrumb and then add one
    * which does not appear on the home page
    *****/

    // has to be called after the action is added
    add_action ('after_setup_theme', 'wmrt_remove_graphene_bc');
    function wmrt_remove_graphene_bc() {
    remove_action ('graphene_top_content', 'graphene_breadcrumb_navxt');
    }

    add_action('graphene_top_content', 'wmrt_breadcrumb_navxt');
    function wmrt_breadcrumb_navxt () {
    //by calling this at this point is_home() works!
    if ((function_exists('bcn_display')) && (!(is_home()))) {
    echo '<div class="breadcrumb">';
    bcn_display();
    echo '</div>';
    }
    }
    ?>

    raindance

    #17108

    Interesting, if I rename the child functions theme file so it’s not used, I can log in.

    Then I just renamed it back to functions.php again in the theme folder after I was logged in and its ok once I’m in. So it seems something in that added code is making it so I just can’t log in? Now that I’m in I could disable plug ins or what not, but I don’t know what’s causing the conflict. I think maybe that last breadcrumb code since that was the last thing I added I think but not sure. Any help appreciated. Why is it giving me the error to log in?

    Thanks

Viewing 10 posts - 1 through 10 (of 15 total)
  • You must be logged in to reply to this topic.
Do NOT follow this link or you will be banned from the site!