| bio | website | |
|---|---|---|
| location | ||
| age | ||
| visits | member for | 1 year, 8 months |
| seen | Oct 23 '11 at 12:39 | |
| stats | profile views | 5 |
|
Oct 22 |
comment |
Dynamically exclude menu items from wp_nav_menu Souseekah, you're the man: that worked like a charm. Thanks a lot! |
|
Oct 22 |
comment |
Dynamically exclude menu items from wp_nav_menu That make sense. I'll try the new version and let you know. |
|
Oct 22 |
comment |
Dynamically exclude menu items from wp_nav_menu Damn... Hahaha. Well, in my defense, I have to admit it was pretty late. But stiil... |
|
Oct 22 |
comment |
Dynamically exclude menu items from wp_nav_menu That would be a good workaround in general, but in this particular case, wp_get_nav_menu_items won't retrieve the images because the img tags are not stored in the actual custom menu (only their filenames are in the description field, e.g., "image1.png"). The custom walker is what allows me to insert the img tags in the menu output. |
|
Oct 22 |
comment |
Dynamically exclude menu items from wp_nav_menu I confirmed that cond. tags don't work on filters applied to wp_nav_menu_items. This code prints the same image: function bla ($items) {
$image_number = ( is_user_logged_in ) ? '2' : '1';
$items .= ( is_user_logged_in ) ? '<a href="'.wp_logout_url( $_SERVER['REQUEST_URI'] ).'"><img src="'.get_bloginfo('template_url').'/images/skin1/login_'.$image_number.'_normal.png" alt="Log Out" title="Log Out" /></a>' : '<a href="'.wp_login_url( $_SERVER['REQUEST_URI'] ).'"><img src="'.get_bloginfo('template_url').'/images/skin1/login_'.$image_number.'_normal.png" alt="Log in" title="Log in"/></a>';} |
|
Oct 22 |
comment |
Dynamically exclude menu items from wp_nav_menu I updated my original post to include this for clarity. |
|
Oct 22 |
comment |
Dynamically exclude menu items from wp_nav_menu Hi Saq, I forgot to mention that one of the solutions that did not work was to create a custom nav_menu function and add that code as an additional argument to the function's defaults. Sadly, it did not work. I didn't try to include it in the walker, but I don't think that would work either for the same reason I mentioned above, mainly that the wp_nav_menu does not have an "exclude" argument, but I could be wrong. |
|
Oct 21 |
comment |
Dynamically exclude menu items from wp_nav_menu Nope, that didn't work either. I think I'm brain dead from trying to figure this out, so that might be affecting my... "performance", :-) |
|
Oct 21 |
comment |
Dynamically exclude menu items from wp_nav_menu Sorry about that: I had a typo in my function. I just tried $exclude = array ('4', '7'); and using the slugs too, but it is not having any effects on the walker output. I'll try the second approach and let you know. |
|
Oct 21 |
comment |
Dynamically exclude menu items from wp_nav_menu I tried the constuctor approach and, no matter what I try, I keep getting a "Wrong datatype for second argument" error for the in_array function. Am I doing something wrong? |
|
Oct 21 |
comment |
Dynamically exclude menu items from wp_nav_menu Don't worry about it! |
|
Oct 21 |
comment |
Dynamically exclude menu items from wp_nav_menu Thanks! That might work. I'll give it a try and let you know. |
|
Oct 21 |
comment |
Dynamically exclude menu items from wp_nav_menu I thought of passing an exclude argument too, but, contrary to wp_list_pages and many other WP functions, wp_nav_menu does not include one. So even if I do specify one when calling the menu or in the walker, it wouldn't get picked up inside wp_nav_menu, would it? |
|
Oct 21 |
comment |
Dynamically exclude menu items from wp_nav_menu Hi Souleseekah, I just added it to my original post. Thanks! |