• In the website I’m building each of my Featured Pages on the home page will be a different section of the website – these sections all need different menus.

    I’m following an answer given here; https://wpquestions.com/question/showChrono/id/8689 – specifically the answer by member ‘tong chen’

    In his and other answers it mentions to place some code ‘where the menu is referenced’

    Where in the Customizr theme is the menu referenced?

    Thanks

Viewing 15 replies - 1 through 15 (of 16 total)
  • customizr/parts/class-header-menu.php

    Thread Starter jeston

    (@jeston)

    Thanks. Thought it was that.

    Which brings me to the next question – Which bit am I replacing?

    Following the step in the above link –

    step 2,change where the menu is referenced:

    <?php
    if( is_page() && get_post_meta( $post->ID, 'page_menu', true )!='' ){
    	global $post;
    	$menu_id = get_post_meta( $post->ID, 'page_menu', true );
    	wp_nav_menu( array( 'container_class' => 'menu-header', 'menu' => $menu_id ) );
    }else{
    	//default menu
    	wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) );
    }
    ?>

    That’s the code I need to input. What do I need that to replace?

    Thread Starter jeston

    (@jeston)

    I’m still trying to do this..

    If anybody could help it would be much appreciated..

    rdellconsulting

    (@rdellconsulting)

    Did you ever see this Snippet?

    Lateral thought: did you consider setting up a multisite? Each FP item would be a subdomain, so you’d have something like:

    homesite.com
    site1.homesite.com
    site2.homesite.com
    etc

    Each site could then use its own standard WP Menu.

    Thread Starter jeston

    (@jeston)

    Thanks for the reply. I’ll look into the multisite. Sounds interesting and could be perfect for the website I need this for actually.

    I’ll post back here should I need any other help. Thanks again.

    Thread Starter jeston

    (@jeston)

    @rdellconsulting

    A question: The wordpress site is currently located at homesite.org.uk/wordpress/ with another non-wordpress site at homesite.org.uk

    When the wordpress site is complete I’ll move it to replace the existing site.

    Will the multisite function work yet? Or should I wait until I’ve overwritten the existing site?

    Either way I think I might look into trying what I was doing before..

    RE the Snippet you’ve linked to.. I’ve found various similar ones but the main trouble I’m having (with my limited coding knowledge) is changing the code to my exact needs. I can register extra menus but I can’t find a way to use a certain menu only on certain pages. That’s where I’m stuck.

    rdellconsulting

    (@rdellconsulting)

    With setting up Multisite, I don’t think it should make a difference either way. Make sure you backup before you try it though.

    I’m not a php expert either, so will flag to Nic to see if he can help.

    Thread Starter jeston

    (@jeston)

    Thanks. I’ve read you can set up the sub-domains as homesite.com/site1, homesite.com/site 2 etc, which has swayed me to try multisites.

    Now I’m wondering how the Featured Pages would work. I’ve got 4 FP’s on my homepage, each would be a link to one of the sub-domains. In the Customizr settings you can choose the FP’s to link to a Page.. how would I link to the sub-domain? Also the images.. they’re set by adding the featured image on a Page.. If it’s linking to a sub-domain, not a Page, how would I get images to show?

    rdellconsulting

    (@rdellconsulting)

    Firstly, there’s 2 kinds of multisite:
    Subdomain – site1.homesite.com
    Subfolder – homesite.com/site1

    Personally, I’ve found the subdomain to be better for me (for reasons I can’t really explain, just gut-feel). But once you’ve decided, then difficult to change without restarting (which I have done). Read the stuff in the Codex if you haven’t already.

    Either way, each site will feel like a full WP install so the 4 FPs will be available on each site. The url link should be set using this snippet

    Remember that each subdomain will have it’s own Child Theme (style.css, functions.php)

    Also, I’m working with you to try this. I have test multisites working fine. But I can’t guarantee that this will achieve what you need. I trust you have the time to spare in case this goes wrong. I will try and help you through as best I can.

    Thread Starter jeston

    (@jeston)

    Ok.. I’m still leaning towards the subfolders style purely for aesthetic reasons. I think I’ll try multisites on a personal domain I own (is it (relatively) easy to reverse?) before trying for this project as it’s a new website for a Charity I work for.

    Although as the site is homesite.org.uk/wordpress – will the subfolders be homesite.org.uk/site1 or homesite.org.uk/wordpress/site 1?
    And once I replace the existing site and move the wordpress to homesite.org.uk – will the multi-sites automatically follow suit? Or is that something I’d have to change manually?

    By the way I appreciate you taking the time to help me with this. I understand you’re by no means an expert in multisites yourself so sorry for all the questions!

    rdellconsulting

    (@rdellconsulting)

    homesite.org.uk/wordpress/site 1 but I don’t like the /wordpress/ subfolder and avoid using it.

    Thread Starter jeston

    (@jeston)

    I’ve set up multisites on my own domain and am testing things out. Couple of questions..

    You said each site will have it’s own child theme etc – where are these located? If connecting via FTP how can I see each sites stylesheet for example?

    The Snippet you linked me to about linking the FPs, I’m not sure I fully understand it. If I’m linking to one of my other sites (so not a ‘page’ but the home page of that site) what does the ‘page id’ become?

    //page id => 'Custom link'
            2 => 'https://www.my-custom-url-one.com',
            9 => 'https://www.my-custom-url-two.com'
    Thread Starter jeston

    (@jeston)

    One more thing – a question you may or may not be able to answer – This Featured Pages Plugin, if I purchase it, will the activation key allow me to use it on only one site or multiple?

    Thread Starter jeston

    (@jeston)

    Original post is too old to edit so going to have to multipost again. Apologies.

    Disregard bit about linking the FPs – Have figured that out.

    Edit to my question about each sites child theme:
    Added some CSS into the child theme stylesheet and the changes applied to all sites on the network. Not sure whether I’d want that or to have a seperate stylesheet for each site. Think I’d want to have something different about each site – so how could I make certain CSS apply to a particular site?

    ElectricFeet

    (@electricfeet)

    alternatively, you could try using the plugin “Page Specific Menu Items” https://www.ads-software.com/plugins/page-specific-menu-items/ It seems to have good reviews.

    (If you do, let us know how it goes.)

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Different menus on different pages’ is closed to new replies.