• Resolved dakranii

    (@dakranii)


    How can I get a Home link in my menu to take me back to the main page, not to a page called /home?

    https://www.mike-chapman.com is where I’m working. If I create a page called Home, it just takes me to /home. If I delete the home page, there’s nothing to click on except the header image that will take me back to the main blog page.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The template tag, wp_page_menu(), was designed to show a “Home” link without actually having to create a Page.

    <?php wp_page_menu('show_home=1'); ?>

    Typically wp_page_menu would be used in place of wp_list_pages.

    Thread Starter dakranii

    (@dakranii)

    Good to know. I don’t know php, but I can guess how it works to some degree and play around with it

    My menu is displayed with:
    wp_list_pages(‘title_li=&depth=2&sort_column=menu_order’);

    I tried sticking &show_home=1 in there, but that didn’t display anything:
    wp_list_pages(‘title_li=&depth=2&sort_column=menu_order&show_home=1’);

    Then I tried replacing list_pages with page_menu, but that makes the menu display below the location for it, making half of it unseen:
    wp_page_menu(‘title_li=&depth=2&sort_column=menu_order&show_home=1’);

    I’m going to keep playing around with it when I have more time. Thank you for the quick reply.

    You could always add a link to your home(main) page in your blog roll and just link it to your main page.

    Thread Starter dakranii

    (@dakranii)

    I see why my playing around didn’t work. wp_page_menu does not support ‘title_li=’, while wp_list_pages does. And wp_list_pages does not support show_home. So I thought for a second I was stuck with trying to rework the theme (or at least the style sheet) to get what I want to work.

    But then I found this code and it worked for me:

    Thread Starter dakranii

    (@dakranii)

    Oops, forgot the backticks

    <li><a href="<?php echo get_option('home'); ?>" rtitle="<?php
    bloginfo('name'); ?> Home Page">Home</a></li>

    Thank you for the answers everyone!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How do I get a Home link in menu?’ is closed to new replies.