WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Adding a menu to a page other than homepage (25 posts)

  1. lawlessvintage
    Member
    Posted 1 year ago #

    Hi,
    I am trying to build my first website & am having trouble understanding how to put a menu I created onto a specific page.

    I have read the answers already given and watched youtube vids but still cant get it to sink in. the site is mbmfabricators.com, I dont even think it shows up until bottom of first search page. The page I want the menu on is the Industry Affiliations page and the menu that I made has a bunch of website links on it. thanks

  2. Don Betts
    Member
    Posted 1 year ago #

    Register the menu in the functions.php. http://codex.wordpress.org/Navigation_Menus#Register_Menus

    Create a custom page template for Industry Affiliations.
    http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates

    Place the code for the menu in that template where you want the menu to display.
    http://codex.wordpress.org/Navigation_Menus#Display_Menus_on_Theme

    When in doubt, check the codex first.

  3. lawlessvintage
    Member
    Posted 1 year ago #

    Hi Don,

    Thanks for helping me.

    Do I do the steps above in that exact order?

    Karen

  4. lawlessvintage
    Member
    Posted 1 year ago #

    I copied & pasted the example in the codex & replaced the their example
    header menu with my websites of interest and this is the error message I got
    Fatal error: Cannot redeclare register_my_menus() (previously declared in /home/lawless/public_html/mbmfabricators.com/wp-content/themes/blogolife/functions.php:19) in /home/lawless/public_html/mbmfabricators.com/wp-content/themes/blogolife/functions/fe/setup.php on line 20

  5. lawlessvintage
    Member
    Posted 1 year ago #

    everything is gone.

    all my pages, its all gone. I went back to functions php and took out what I did, but I must have done it wrong because now everything is gone.

    And I DID NOT make a childs theme, I just want to cry.

  6. Don Betts
    Member
    Posted 1 year ago #

    It's not a done deal, yet. We've all probably been in the same boat you're in now and I've shed my own tears, but let's see if we can get you back up and running.

    Your site isn't gone, it's just that when you deleted what you had cut and pasted in you probably deleted something extra - it could be as little as a semicolon - and it's giving you an error. Think of it as a locked door, but the house is still behind the door. Basically, the easiest thing to do is to reinstall your theme which will set everything back the way it was. Then you'll be able to see you're content again

    1. Download the theme again http://wordpress.org/extend/themes/blogolife and unzip the files onto your computer.

    1. FTP into your site's files - your webhost will have instructions how to do that so look it up on their support pages if you don't know how. Often they'll have a web based FTP program you can use but if not they'll should suggest some (depends on what OS you're using)

    2. Once you're connected via FTP you'll see all the files that make up WordPress. Find the folder "wp-content" and then the folder "themes"

    3. Replace the "blogolife" folder with the one you just downloaded and unzipped (it will probably ask if you want to replace the folder and you do).

    If all that has worked, you should be able to access your site again. When that's done, drink a large glass of the beverage of your choice and feel your heart return to a normal pace, then we'll deal with the menu again, if you're up to it.

  7. lawlessvintage
    Member
    Posted 1 year ago #

    Don, I am going to go and follow all your directions, Thank You for being so smart & sharing your knowledge with me. Hopefully I can pull this off, I will let you know.

    P.S. was I at least right about the copy & paste idea? but just probably entered some code wrong.

    Karen

  8. Don Betts
    Member
    Posted 1 year ago #

    Hope all goes well. I think you are right about the cut and paste - you likely entered or deleted something important. It's all part of the growing pains - if I had a dollar for each time I used to have to reinstall themes...

    Good luck!

  9. lawlessvintage
    Member
    Posted 1 year ago #

    I am so glad that drama is over with. Thank You Don, I would not have known how to recover from that. OK, well back to the original problem.

    Can I just copy & paste the code from codex

    function register_my_menus() {
    register_nav_menus(
    array( 'header-menu' => __( 'Header Menu' ) )
    );
    }
    add_action( 'init', 'register_my_menus' ); instead of the 2 places it says header replace with websites of interest-menu and websites of interest menu ?????????

  10. Don Betts
    Member
    Posted 1 year ago #

    I think what happened last time was that your theme already has a function to add menus in functions.php which is why you got the error that it couldn't register it twice.

    So, look for the already existing register_nav_menus function and just add your new menu to that function. The whole thing should look something like this (the example is just a bit further down on the codex page from which you pulled the code from your last post):

    function register_my_menus() {
      register_nav_menus(
        array(
          'header-menu' => __( 'Header Menu' ),
          'extra-menu' => __( 'Extra Menu' )
        )
      );
    }
    add_action( 'init', 'register_my_menus' );

    By the way, if you're not using a text editor to edit your files via ftp, I highly recommend it. The problem with editing files in the WordPress admin is that if you break something you can't get to the file to fix it because you've broken the admin side as well. If you have access to the files over ftp, you can still get in and fix things, or just replace your functions.php file instead of the whole theme. It took me awhile to learn that one when I was starting out!

  11. lawlessvintage
    Member
    Posted 1 year ago #

    so where the word header is, thats where
    i would put my menu title?

  12. webbrewers
    Member
    Posted 1 year ago #

    It would be easier to create a menu and add a custom menu widget wouldn't it?

  13. lawlessvintage
    Member
    Posted 1 year ago #

    Hello, I am finally back after spending all day yesterday trying to figure out filezilla,hostgator,mysql,etc.....MY BRAIN IS FRIED!!!
    I came back here to get the directions again to put a menu on a page & just read webbrewers suggestion. I do have the custom menu widget, but have not used it, again because I could not figure it out. I do remember reading about that being easier, that was the reason I downloaded it in the first place. How how do i set the custom menu widget onto a certain page? it always goes onto the home page.

    Thanks, Karen

  14. webbrewers
    Member
    Posted 1 year ago #

    First this assumes you want the menu in the sidebar. If so, there's a plug in that lets you control what's shown in the sidebar by page called "Display Widgets".
    I'd get that installed, then create a new menu in appearance>menus.
    Add the custom menu widget to the sidebar and pick your new menu.
    At the bottom of the widget editor box, you'll see options to "hide (or show) on checked".
    If you want the menu on one page, pick "show" and select that page.

  15. lawlessvintage
    Member
    Posted 1 year ago #

    BEAUTIFUL, that worked, thank you. If I want to put it in the body or a left sidebar I assume I just put the custom menu in those spots as well? could it be that easy?

    Karen

  16. lawlessvintage
    Member
    Posted 1 year ago #

    Wait, I figured it out. I had a slideshow going on the page where I wanted to put the custom menu. I took it out so the menu would show up at the top right hand side of the page. I went back into widgets to see if I could somehow put it back on just the homepage, and now my slideshow ALSO gave me the option of which pages to show/hide. VERY COOL!!!! that must be just from getting that plug in called "display widgets" i hope so, that is going to make EVERYTHING so much easier. I am going to go back and fiddle around with some of the other widgets and see if they now have that same option under them when i place them in the sidebar, I hope so.

    THANK YOU, WEBBREWERS

  17. webbrewers
    Member
    Posted 1 year ago #

    If your theme supports a left sidebar, then yes. For the body of a page WP doesn't natively support adding widgets to pages, but there's a plug in you can add (I think) that will let you do that: search plug ins for "widgets on pages" or something like that. Or just add the links right in the page editor.
    By the way, you don't have to use the menu option if this is just a list of links - you can also create a category/list of links under appearance>links and add those as a sidebar widget.

  18. webbrewers
    Member
    Posted 1 year ago #

    "see if they now have that same option under them when i place them in the sidebar, I hope so."

    Yes, this plug in works with any widget and lets you change the look of every page if you want.

  19. lawlessvintage
    Member
    Posted 1 year ago #

    It's so weird, it gives me the options of being able to choose which page, but then it does not show up. I have tried a few different plugins and nothing is workinf after the first initial 2 did. Any ideas?

    Thanks, Karen

  20. lawlessvintage
    Member
    Posted 1 year ago #

    ok, I got it. First off I did a delete cache, and the two items I was tring to get back onto the site I wanted on the home page, so I checked both the front page option under miscellaneous AND the home page option, and that made them appear. I dont know if the delete cache had anything to do with it but I am sure it didn't hurt :-)

    Thanks for everyones help, now I am going to go search for other cool plugins that can help me too.
    Karen

  21. lawlessvintage
    Member
    Posted 1 year ago #

    Webrewers, I just read you email about widgets on pages, I will go and search for that right now. I am very thankful to have this great place to be able to learn and get advice. Sometimes it takes me a little while but then all of a sudden someone will write how to do something in just the right way and BOOM it sinks in. Karen

  22. Don Betts
    Member
    Posted 1 year ago #

    lawlessvintage,
    I was away from my computer all weekend, but I'm glad you found a solution that works. I have to apologize for leading you down a bit of a rabbit trail - I had misunderstood from your original post that you wanted a menu right below the main menu in the header. If I had clarified earlier that you wanted it in the sidebar it woud have saved you a lot of grief.

    Webrewers, thanks for stepping in and pointing out Display Widgets - I've used Widget Logic in the past but Display Widgets looks far easier to use.

  23. webbrewers
    Member
    Posted 1 year ago #

    Sorry for barging into the thread but it seemed like using a plug in was easier than changing the code.

  24. lawlessvintage
    Member
    Posted 1 year ago #

    Don, Every Rabbit hole I go down, I learn a little more. Thanks for taking the time to help and also to webrewers your both aces to me.

    Karen

  25. Don Betts
    Member
    Posted 1 year ago #

    No apology needed. Barge in whenever you want! I misread the original need. I had assumed that lawlessvintage wanted a menu where there was no widget area and therefore have to register a menu and put it into a page template. Your solution was the best one for what was really needed. Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic