wizzud
Forum Replies Created
-
Forum: Plugins
In reply to: [Custom Menu Wizard Widget] Some shortcode items not getting idOkay, from my point of view the answer is straightforward : CMW doesn’t assign the item IDs, WordPress does. However, that probably doesn’t help you very much …
I think you will find that WordPress will only assign an ID if the ID that it intends assigning – in the format menu-item-[ID of the menu item] – has not already been used elsewhere on the page. So, for example, if you were to do jQuery(‘#menu-item-419’) on the page that produced the code pasted above, then you would get a result … but the element located would be somewhere else on the page. This is how WordPress avoids creating invalid duplicate IDs.
PS : If you are after the “menu-item-####” from the class, have you considered using a regex? …
x = (el.className.match(/(^|\s)(menu-item-\d+)(\s|$)/) || [0,0,''])[2];Forum: Plugins
In reply to: [Custom Menu Wizard Widget] Change parent's nameadd_filter( 'custom_menu_wizard_walker_items', 'my_cmw_items_filter', 10, 2 ); function my_cmw_items_filter( $elements, $args ){ if( !empty( $elements ) ){ $elements[1]->title = 'All'; } return $elements; }$elements is the CMW-filtered set of menu items about to be passed through to WordPress’s walker.
$args is all wp_nav_menu’s arguments, plus CMW’s own (from the widget).[ you can test for other conditions, such as class “cmw-level-1” being set, if you wish ]
Forum: Plugins
In reply to: [Custom Menu Wizard Widget] Change parent's nameCMW only provides the means to filter the menu items, not to edit them.
Assuming that you can’t modify the menu itself (because “Fruits” is probably only a small part of it), the code below will replace every occurrence of the string “Fruits” with “All”. But be warned : it’s an all-encompassing solution for any CMW-produced menu … and that may not be what you want!add_filter( 'wp_nav_menu', 'my_cmw_nav_menu_as_dropdown', 10, 2 ); function my_cmw_nav_menu_as_dropdown( $nav_menu, $args ){ if( !empty( $args->_custom_menu_wizard ){ $nav_menu = str_replace( 'Fruits, 'All', $nav_menu ); } return $nav_menu; }Forum: Plugins
In reply to: [Custom Menu Wizard Widget] 2nd Level menu with singlingsThis shows only the 2nd level items (your “B” items) of the current branch…
[custom_menu_wizard menu=NN title="Level 2 of Current Branch" children_of="root" fallback_parent=1 start_level=2 depth=1]Is that not what you are after?
Forum: Plugins
In reply to: [Custom Menu Wizard Widget] Dropdown OutputFrom within the widget itself, No.
You could code an additional filter into your theme’s functions.php to do it, if you wished? As an example…
add_filter( 'wp_nav_menu', 'my_cmw_nav_menu_as_dropdown', 10, 2 ); function my_cmw_nav_menu_as_dropdown( $nav_menu, $args ){ if( !empty( $args->_custom_menu_wizard ) && $args->_custom_menu_wizard['flat_output'] ){ $nav_menu = preg_replace_callback( array( '/<li[^>]*>(.*?)<\/li>/', '/<ul([^>]*)>/', '/<\/ul>/' ), 'my_cmw_nav_menu_as_dropdown_callback', str_replace( '</ul>', '</select>', $nav_menu ) ); } return $nav_menu; } function my_cmw_nav_menu_as_dropdown_callback( $matches ){ $firstChars = substr( $matches[0], 0, 2 ); $rtn = $matches[0]; if( $firstChars == '<l' ){ if( preg_match( '/href="([^"]+)"[^>]*>([^<]+)</', $matches[1], $m ) > 0 ){ $rtn = '<option data-href="' . $m[1] . '">' . $m[2] . '</option>'; }else{ $rtn = '<option>' . $matches[1] . '</option>'; } }elseif( $firstChars == '<u' ){ if( preg_match( '/id="(.*?)"/', $matches[1], $m ) > 0 ){ $rtn = '<select name="' . $m[1] . '"' . $matches[1] . '>'; }else{ $rtn = '<select' . $matches[1] . '>'; } } return $rtn; }Forum: Plugins
In reply to: [Custom Menu Wizard Widget] Main Menu falls back to alphabetical list?(marking as resolved)
Forum: Plugins
In reply to: [Custom Menu Wizard Widget] Schema MarkupCMW’s container option is intended to take a tag, because that’s what wp_nav_menu() handles.
The tags that wp_nav_menu() accepts can be modified from the defaults (“div” or “nav”) by using a filter – “wp_nav_menu_container_allowedtags” (ref: wp_nav_menu() in wp-includes/nav-menu-template.php) – but that filter receives nothing that lets you know whether wp_nav_menu() is processing a CMW menu or some other menu (should you need to be able distinguish).
An alternative might be to hook into wp_nav_menu()‘s “wp_nav_menu” filter. For example…
add_filter( 'wp_nav_menu', 'my_cmw_nav_menu_filter', 10, 2 ); function my_cmw_nav_menu_filter( $nav_menu, $args ){ if( !empty( $args->_custom_menu_wizard ) && !empty( $args->_custom_menu_wizard['container'] ) ){ $nav_menu = preg_replace( '/^<(' . $args->_custom_menu_wizard['container'] . ')/', '<$1 itemscope="itemscope"', $nav_menu ); } return $nav_menu; }Forum: Plugins
In reply to: [Custom Menu Wizard Widget] Assist-preview and actual Menu does not matchGood!
I’m afraid specifying “levels of ancestors” is not currently possible with CMW v2.0*. I am working on a rewrite, and I have it under consideration (it’s been brought up before) … but I can make no promises!
Forum: Plugins
In reply to: [Custom Menu Wizard Widget] Assist-preview and actual Menu does not matchI have released CMW v2.0.6 which – with any luck – might hopefully solve your problem. I can’t be absolutely certain because it is still dependent on the flags (not classes!) set by WordPress or other plugins that modify menus. Give it a try and let me know?
PS : If your custom product posts are provided by a plugin, it might be worth letting the plugin author know about this problem, because the validity of having a parent and child item both marked as “current” (when the items are distinct) might be considered … umm … debatable?
Forum: Plugins
In reply to: [Custom Menu Wizard Widget] Assist-preview and actual Menu does not matchThat’s great, many thanks.
As you’ve found – and as I suspected – your menu has multiple items marked as “current”. Because CMW can only work with *one* current menu item, it takes the first one found, which in your case is on “Products”.
I am looking at a slightly different method of determining which current item to use – if more than one is present. It will still be on a roughly first-found basis, but within prioritised groups depending on what other “current-related” switches are set by WordPress : just current (highest) -> current and parent -> current and parent and ancestor – > current and ancestor (lowest). So, if CMW can find one or more items just marked as current (not current-parent or current-ancestor) then it will use the first of those found; otherwise, it will look for those marked current and current-parent (not current-ancestor), and use the first of those; etc, etc. Give me a day to check it out, and I’ll release it…
Meanwhile, thanks for your patience.
Forum: Plugins
In reply to: [Custom Menu Wizard Widget] Assist-preview and actual Menu does not matchThat is … disturbing.
I can see that the page being displayed is “NC-100 Family” : may I ask, of the classes assigned (in the CMW sidebar widget) to the “Products” item and the “NC-100 Family” item, which item has a class of “current-menu-item” and/or “current_page_item” (or any other class that indicates “current”)?
I appreciate that CMW isn’t currently doing what you need it to, but by any chance do you have a web-accessible page that shows this problem, so that I can take a look?
As some background : the “assist” is an emulator, ie. it does not know or care what the actual menu items represent within WordPress, they are merely “items”. Setting a “current menu item” in the assist makes it act as CMW would (should!) *if* CMW determined that that same item was the first-found item marked by WordPress as “current”. In your case, what I suspect might be happening is that “Products” has been marked – by WordPress – as “current”, so CMW is treating it as such even though the page on display is “NC-100 Family”. (It’s only a suspicion because I can’t see the widget’s shortcode equivalent in your image, so I’m guessing a little bit).
Ideally, I would like to see a CMW instance showing the entire menu (ie. set to Show All) so that I can see what each item’s classes are depending on the current page being shown (if it is possible, and not too much trouble … maybe by giving the widget a class that sets the entire widget to
display:none;?).I’m sorry this is giving you problems, and I appreciate any assistance you can give me in determining the cause.
Forum: Plugins
In reply to: [Custom Menu Wizard Widget] Collapse and expandSimple answer : Yes, of course it is.
Is it simple to do? Depends : If all you want to do is close any item already open at the same level as the one now being opened, then you could just scan parent’s siblings for the relevant data setting and trigger a click. However, what about that open item’s open descendants? Should they also be closed? Or should they remain open? Also, scanning siblings for a data setting is more expensive than filtering siblings for a class, so depending on the number of items in your menu, it might be better to switch to using classes to indicate “open-or-closed” instead of data.
Am I going to do it for you? Hmmm … prob’ly not.
Forum: Plugins
In reply to: [Custom Menu Wizard Widget] Multisite compatibilityWith all due deference, I suspect it’s not. If CMW works with a theme, but not with a child of that theme, then surely the implication is that the problem lies with whatever has changed between the 2 scenarios, ie. the child theme?
If you have “inactive sidebars” – as opposed to a non-functioning widget within a sidebar – maybe your child theme is somehow preventing the parent theme registering its sidebars?Forum: Plugins
In reply to: [Quick Page/Post Redirect Plugin] parse errorsI, too, had this problem, and I determined that (in my case) the url being given to the appip_parseURI() method was an empty string, which resulted in parse_url() attempting to parse “http://” and bombing out.
My solution was to edit page_post_redirect_plugin.php and insert the following line of code at line 1148 (the first executable line of appip_parseURI())…
if( $url == '' ){ return array( 'url' => $url ); }My usage of this plugin is very limited (a single redirect), but this at least allowed me to edit posts/pages again without getting these errors!
[ The appip_parseURI() method is only called from one place in the class, and on its return, the ‘url’ element of the returned array is assigned to a “my_meta_data” array, escaped as a raw url, and then tested as being equal to http[s]:// or an empty string … at which point it is deemed non-applicable and the post meta is cleared down. ]
Forum: Plugins
In reply to: [Custom Menu Wizard Widget] Custom look for custom menuYes, but you have to provide it yourself.
CMW does not provide any front end styling : themes handle styling, and if I tried to provide additional styling it would be “wrong”, in some way or another, and to greater or lesser degrees, for almost every single user!
You have the ability to add class(es) and/or a unique id to any instance of the widget. You can then add CSS rules to your (child?) theme’s stylesheet to override your theme’s default styling. I would suggest giving the widget container a unique id or class, and then using Firebug (or similar) to dynamically override the current rules (with new rules using your added id/class) to suit what you want. Then copy your updates into your stylesheet.