dave1234
Forum Replies Created
-
Forum: Hacks
In reply to: Hide a menu item from regular usersMany Thanks!
Unfortunately I couldn’t just use that in a child theme as is, because I didn’t really know about child themes and I’ve already hacked up my theme pretty good. So I adapted what you wrote into a hack to my theme.
I just had to change my code to this in header.php:
if(current_user_can(edit_posts)) { /* Header menu */ $args = array( 'container' => '', 'menu_id' => 'header-menu', 'menu_class' => 'menu clearfix', 'fallback_cb' => 'graphene_default_menu', 'depth' => 5, 'theme_location' => 'contrib-menu', ); wp_nav_menu(apply_filters('graphene_header_menu_args', $args)); } else //normal visitors will see this { /* Header menu */ $args = array( 'container' => '', 'menu_id' => 'header-menu', 'menu_class' => 'menu clearfix', 'fallback_cb' => 'graphene_default_menu', 'depth' => 5, 'theme_location' => 'Header Menu', ); wp_nav_menu(apply_filters('graphene_header_menu_args', $args)); }And this in functions.php:
// This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'Header Menu' => __('Header Menu', 'graphene'), 'secondary-menu' => __('Secondary Menu', 'graphene'), 'contrib-menu' => __('Contrib Header Menu', 'graphene'), ) );So, basically just adding the contrib menu in the code, and then of course I had to make a new menu in the dashboard for the Contrib Header Menu.
The fact that menu_id was set to ‘header-menu’ was super confusing to me, since it has this other thing called ‘secondary-menu’. But apparently those 2 things are not the same type of thing at all, ‘header-menu’ is do to with the style id or something, and you can see his naming convention is just not uniform (the header menu is called “Header Menu”, yet the secondary menu is called “secondary-menu”.
I was still pretty confused until just writing this reply now, now I see that my new “contrib-menu” is the counterpart to the original “Header Menu”, and the second instance of ‘Header Menu’ in the code “‘Header Menu’ => __(‘Header Menu’, ‘graphene’),” is the text that shows up in the Menus dashboard. If you see what I mean, the confusing part is the usage in header.php of header-menu vs contrib-menu.
I know that hacking the base theme instead of using a child theme is a bad way to go about things, but I’ve hacked up my theme enough now that it would take some doing to revert it and switch the changes to a child theme (compounded by the fact that I have no idea how to make a child theme although I’m sure I could learn).
Thanks again
Forum: Hacks
In reply to: Hide a menu item from regular usersHum, well in my theme’s header.php there’s this:
<?php /* The navigation menu */ ?> <?php /* Header menu */ $args = array( 'container' => '', 'menu_id' => 'header-menu', 'menu_class' => 'menu clearfix', 'fallback_cb' => 'graphene_default_menu', 'depth' => 5, 'theme_location' => 'Header Menu', ); wp_nav_menu(apply_filters('graphene_header_menu_args', $args));So it seems to me like somehow right there I could add code to say Don’t show a certain menu item (by id or slug name or something) when the user is less than an Author.
Could use help on doing that though…
Forum: Fixing WordPress
In reply to: Drag and Drop stopped working for custom menus in dashboardThis problem was caused by an update of the Forum Server plugin from a day or 2 ago.
Today there was a new update for Forum Server, which I upgraded to, and now the problem I was having is no longer happening.