Tagged: custom menu, portfolio category
-
AuthorPosts
-
February 13, 2015 at 6:06 am #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,
JasonFebruary 13, 2015 at 8:57 pm #395998Hi 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,
AndyFebruary 13, 2015 at 11:34 pm #396052This reply has been marked as private.February 16, 2015 at 5:17 pm #396829Hey!
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.
March 10, 2015 at 5:14 am #408606Hi 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.
March 10, 2015 at 8:03 pm #409043Hi!
Try this.
is_post_type_archive('portfolio')
Or this.
is_tax('south-canterbury-past-issues')
Regards,
ElliottMarch 10, 2015 at 10:24 pm #409578This reply has been marked as private.March 11, 2015 at 5:31 pm #409979Hi!
Send us an FTP login please.
Regards,
Elliott- This reply was modified 9 years, 8 months ago by Elliott.
March 11, 2015 at 9:25 pm #410114This reply has been marked as private.March 12, 2015 at 8:22 am #410339Hi!
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,
IsmaelMarch 15, 2015 at 9:36 pm #411752Hi 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,
JasonMarch 15, 2015 at 9:51 pm #411757Ok, 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=5March 17, 2015 at 6:43 am #412782Hi!
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!
IsmaelMarch 17, 2015 at 10:13 pm #413266Thanks Ismael,
All sorted now.
Jas -
AuthorPosts
- The topic ‘Custom menu based on portfolio category’ is closed to new replies.