| bio | website | timothy-decker.com |
|---|---|---|
| location | Los Angeles, CA | |
| age | 24 | |
| visits | member for | 3 months |
| seen | Apr 24 at 21:54 | |
| stats | profile views | 1 |
|
Jan 31 |
comment |
Custom Permalink Plugin and Current Page/Ancestor in Menus Thanks for all your help, @Milo. With your input I was able to come up with a flexible solution that I hope helps others too! |
|
Jan 30 |
comment |
Custom Permalink Plugin and Current Page/Ancestor in Menus So I made some edits to come up with what should be working to add menu classes. Essentially I'm evaluating whether the $item->url is equivalent to the current url's directory path. Current-page-ancestor classes aren't being added yet, so I'm still missing something. See edit above. |
|
Jan 29 |
comment |
Add Standard Page Attributes Metabox for Page Parent Sorry, the plugin is Woocommerce. I didn't think it pertinent. I'm fairly certain the post type is hierarchical because the function gets past that 'if' statement. See my original post for new code edits. Thanks! |
|
Jan 28 |
comment |
Custom Permalink Plugin and Current Page/Ancestor in Menus NM, found the code to print the $post variables. The page_parent is set to 0, so there is my problem. But there is no Parent Page field to edit in the custom 'product' post backend. Is there a filter I can apply to add that option? |
|
Jan 28 |
comment |
Custom Permalink Plugin and Current Page/Ancestor in Menus Do you have a piece of 'inspector' code that will let me see the post object for the current product page so perhaps I can find a value that will help me select which menu item it is a part of? Just like the code you gave me to see the menu construction. |
|
Jan 28 |
comment |
Custom Permalink Plugin and Current Page/Ancestor in Menus I understand now how the menus are built and why your code works, so thank you for that inspector code. To your second thought: the product children aren't part of the menu, only the parents are (i.e. 'Shop' and 'New'|'Used'). I believe Wordpress is having troubling recognizing the product pages as children because they have custom permalinks and their original parent is an entirely different page. Is there some way to hook into the new permalink to get a value that might match one of the menu item titles? |
|
Jan 28 |
comment |
Custom Permalink Plugin and Current Page/Ancestor in Menus Okay, so that worked well (although I'm not 100% clear how). But I'd like to add another step if I may. This may be another part of the function. Am I able to add current-page-ancestor to a menu list item based upon different sub-parent pages. e.g. website.com/shop/new/product and website.com/shop/used/product. Where the menu would have Shop -> New | Used and the individual product page would determine whether New or Used got the current-page-ancestor class? Hope that's clear! |