Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #395513

    Hi there,
    I’m using Zen Menu Logic to specify a custom menu on a page by page basis, but I need a way to display a specific menu for a specific portfolio category.
    It’s a one-off, so I have no problem creating a template for this portfolio category, I just need a little guidance please.
    Which theme file would I duplicate & how would I add the menu code required?
    Or should I do this in functions.php (I’m running Enfold Child).
    The portfolio category is called ‘south-canterbury-past-issues’ & the menu I’d like displayed is called ‘south canterbury’ & the menu location is ‘main’.
    Can you help please?
    Thanks you,
    Jason

    #395998

    Hi Jason!

    I am not really sure if I get what you mean. Could you please post a link to your website? and also could you send us a mockup of what you want to achieve? so we can get a better idea.

    Best regards,
    Andy

    #396052
    This reply has been marked as private.
    #396829

    Hey!

    You could do something like this, https://kriesi.at/support/topic/creating-a-custom-templatemenu/#post-372799.

    But to check for a portfolio category then you would could try using this conditional check, http://codex.wordpress.org/Function_Reference/is_post_type_archive, instead of is_page().

    Cheers!
    Elliott

    • This reply was modified 9 years, 9 months ago by Elliott.
    #408606

    Hi Elliott,
    I tried this piece of code (based on your advice) but no joy.
    'menu' => ( is_post_type_archive('south-canterbury-portfolio') ? 'south canterbury' : null ),
    What am I missing?
    This is the portfolio category;
    /wp-admin/edit-tags.php?action=edit&taxonomy=portfolio_entries&tag_ID=81&post_type=portfolio
    Should I be including the ID somewhere in that code?
    The slug is ‘south-canterbury-past-issues’ which I’m guessing is not what I should be using in this instance?
    Jas

    • This reply was modified 9 years, 8 months ago by Jason.
    #409043

    Hi!

    Try this.

    is_post_type_archive('portfolio')
    

    Or this.

    is_tax('south-canterbury-past-issues')
    

    Regards,
    Elliott

    #409578
    This reply has been marked as private.
    #409979

    Hi!

    Send us an FTP login please.

    Regards,
    Elliott

    • This reply was modified 9 years, 8 months ago by Elliott.
    #410114
    This reply has been marked as private.
    #410339

    Hi!

    If I may interject, you should try this plugin: https://wordpress.org/plugins/menu-items-visibility-control/

    Add the menu items inside the Enfold Main Menu then set the Visibility:

    is_tax( 'portfolio_entries', 'economics' );
    

    This will only show the menu item on portfolio category page “economics”. If you don’t want to show the default menu items inside the category page, use this:

    !is_tax( 'portfolio_entries', 'economics' );
    

    Regards,
    Ismael

    #411752

    Hi Ismael,
    Thanks for that – looks good, but either the plugin doesn’t work with the latest version of WP or there seems to be a conflict with an existing plugin as I’m unable to add anything to the menu when that plugin is activated.
    JS related probably, the drop-downs (links etc) don’t drop-down within Menu’s in the Dashboard.
    I’d prefer to add this functionality with a code snippet (as opposed to plugin – if possible) it looks like we are pretty close to this, so even though the plugin would have been a nice simple/quick solution – it doesn’t look like its going to do the trick in my case.
    Can you still help with that code?
    Thanks,
    Jason

    #411757

    Ok, I’ve done a little digging & it seems the issue I’m having is a know one with this plugin;
    https://wordpress.org/support/topic/can-not-add-or-arrange-menu-items-with-plugin-active?replies=5

    #412782

    Hi!

    The plugin works fine on our installation. If you want to do manual coding, you can edit code includes > helper-main-menu.php, look for this code:

    $avia_theme_location = 'avia';
    

    Add the is_tax function, something like this:

    if(!is_tax('portfolio_entries', 'economics')) {
    						        $avia_theme_location = 'avia';
    								} else {
    								$avia_theme_location = 'avia4';	
    								}
    

    Replace “economics” with your own portfolio category. Add this to the functions.php:

    add_action('init', 'ava_add_custom_menu');
    function ava_add_custom_menu() {
    	register_nav_menus(array('avia4' => __('Enfold Custom Menu', 'avia_framework')));
    }
    ava_add_custom_menu();

    Create a new menu on Appearance > Menus panel then set it as Enfold Custom Menu.

    Cheers!
    Ismael

    #413266

    Thanks Ismael,
    All sorted now.
    Jas

Viewing 14 posts - 1 through 14 (of 14 total)
  • The topic ‘Custom menu based on portfolio category’ is closed to new replies.