WordPress.org

Ready to get started?Download WordPress

Forums

Ryu
[resolved] How to remove "Home" from nav bar***only when @Home (19 posts)

  1. cbilgen
    Member
    Posted 11 months ago #

    To any who may help,
    How can I remove "Home" link/button from my navigation bar only for when I'm on the home page? (I want it there for other pages, but to have an extra button for "Home" when already on the Home page is unnecessary and adds clutter...)
    My site is http://baykusmedia.com/

    Thanks alot!
    C.

  2. esmi
    Forum Moderator
    Posted 11 months ago #

    Try adding:

    function my_show_home( $args ) {
    	$args['show_home'] = false;
    	return $args;
    }
    add_filter( 'wp_page_menu_args', 'my_show_home' );

    to your child theme's functions.php file.

  3. cbilgen
    Member
    Posted 11 months ago #

    Hmm, I must be doing something wrong because it is not changing anything...Does that code just go anywhere in the functions.php file?

  4. esmi
    Forum Moderator
    Posted 11 months ago #

    Yes. Anywhere after the opening <?php tag of your child theme's functions.php file. Please note that I made a minor error in the original code that I've now corrected. Try again with a new copy.

  5. cbilgen
    Member
    Posted 11 months ago #

    I am still unfortunately not seeing any change. Also, I just noticed I had moved(instead of copied) the functions.php from my parent to the child theme. and when I try to replace it/re-copy it back, my site goes blank...could this have something to do with why it is not working?

  6. WPyogi
    Volunteer Moderator
    Posted 11 months ago #

    The child theme functions file cannot be a copy of the parent one - it will crash the site. The child theme one should only contain the above code esmi posted. Also see:

    http://codex.wordpress.org/Child_Themes#Using_functions.php

  7. cbilgen
    Member
    Posted 11 months ago #

    Ahh ok that is good to know. Now though, I put the code in the child theme's functions.php and the code itself shows up at the top of my website...

  8. cbilgen
    Member
    Posted 11 months ago #

    Ok fixed that, but my Home button is still there...
    here is my functions.php in my child theme:

    <?php
    function my_show_home( $args ) {
    	$args['show_home'] = false;
    	return $args;
    }
    add_filter( 'wp_page_menu_args', 'my_show_home' );
    ?>

    Is something wrong?

  9. paulwpxp
    Font hero
    Posted 11 months ago #

    That Home menu item has this class menu-item-42, so it's what you put there. To not display this only on front home page, use body class to target it and display none.

    .home.page .menu-item-42 { display:none; }
  10. cbilgen
    Member
    Posted 11 months ago #

    Forgive my incompetence with code, but where does .home.page .menu-item-42 { display:none; } go?

  11. esmi
    Forum Moderator
    Posted 11 months ago #

    Add it to the bottom of your child theme's stylesheet.

  12. cbilgen
    Member
    Posted 11 months ago #

    Wow so simple! Worked great, thanks alot for the help everyone.

    Also, would you happen to know how I can hide the "Home" page title that shows up at the bottom of the home page as well?

  13. esmi
    Forum Moderator
    Posted 11 months ago #

    Try:

    body.home.page .entry-header {
    display: none;
    }
  14. cbilgen
    Member
    Posted 11 months ago #

    Awesome- thanks esmi!

  15. esmi
    Forum Moderator
    Posted 11 months ago #

    No probs. :-)

  16. cbilgen
    Member
    Posted 11 months ago #

    Also, is there a way to remove the footer? I removed the text content of the footer but I'd like to get rid of the divider/extra space as well. I tried deleting the footer content completely but it messed up my search bar at the top of my site.
    Any suggestions?

  17. esmi
    Forum Moderator
    Posted 11 months ago #

    Untested but try just placing:

    </div><!-- #main -->
    	<footer id="colophon" class="site-footer" role="contentinfo">
    		<div class="site-info wrap">
    		</div><!-- .site-info -->
    	</footer><!-- #colophon -->
    </div><!-- #page -->
    
    <?php wp_footer(); ?>
    </body>
    </html>

    in the child theme's footer.php file.

  18. cbilgen
    Member
    Posted 11 months ago #

    Got it, just had to delete the </div parts.

  19. cbilgen
    Member
    Posted 11 months ago #

    Thanks again!

Reply

You must log in to post.

About this Theme

About this Topic