Support » Fixing WordPress » Showing a different menu in Primary Navigation location conditionally in Genesis

  • Hi,
    My use case:
    I am trying to create an event planning website that contains access to my blog.
    When you click the link to my blog, I want an entirely new navigation tab or menu.
    I currently have a theme that is powered by genesis. This code looks like it may solve my issue:
    https://gist.github.com/srikat/5d40d43cd2df122fed41#file-functions-php
    I am trying to use this code in this Functions plug in:
    https://wordpress.org/plugins/my-custom-functions/

    The issue I am having is that I am not exactly sure what to replace in the code with my information. OR if this is even what I am looking to do…
    Any help is very much appreciated!!! Thank you!

    The blog I need help with is ashleysodipo.com.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Karan NA Gupta

    (@nuancedesignstudio)

    Hi,

    You should put your customizations in functions.php of your genesis child theme.

    Alternatively if it’s the blog page that you want to target you can also create a Page Template and apply it to your Blog Page. In this case you will put the code in this custom-template php file.

    Here is an article that may help you:
    https://wpsites.net/web-design/add-content-before-posts-blog-page-only/

    Regards,
    Karan

    Moderator bcworkz

    (@bcworkz)

    Yes, that github code should do the trick. I don’t know about putting the code on a template, it may execute to late. It may be OK if it’s the very first code, even before get_header(). However, if you’re creating a template specifically for this, simply make a call to wp_nav_menu() directly using your own parameters. But since the nav menu call is likely on a common header file, you’d have to replicate the header file code on your template so the nav menu parameters can be altered. Not ideal.

    functions.php of a child theme is normally a great location, but in the case of Genesis themes, this child is not really yours to alter as you wish. In theory the child could be updated and your code overwritten, though I’ve never noticed such themes ever being updated.

    You certainly do not need a plugin so you can enter your own code. While that would work, you may as well simply create your own plugin. The github code will work fine from a plugin. Personally, this is what I would do, create my own plugin. I can then add any other custom code that comes up here as well. Creating your own plugin might sound pretty involved. It can be, but in this case it’s quite simple. Make a new file in the plugins folder, include the proper header comment that identifies the file as a plugin. Copy the github code onto this page. Modify the code as noted for your situation. Go to the plugins screen and activate. That’s it!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Showing a different menu in Primary Navigation location conditionally in Genesis’ is closed to new replies.