11 reputation
4
bio website timothy-decker.com
location Los Angeles, CA
age 25
visits member for 1 year, 7 months
seen Mar 24 at 18:09

2d
awarded  Popular Question
Jan
31
awarded  Scholar
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
31
accepted Custom Permalink Plugin and Current Page/Ancestor in Menus
Jan
31
answered Custom Permalink Plugin and Current Page/Ancestor in Menus
Jan
30
revised Custom Permalink Plugin and Current Page/Ancestor in Menus
added 1043 characters in body
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
30
revised Add Standard Page Attributes Metabox for Page Parent
added 373 characters in body
Jan
29
revised Add Standard Page Attributes Metabox for Page Parent
deleted 35 characters in body
Jan
29
revised Add Standard Page Attributes Metabox for Page Parent
added 425 characters in body
Jan
29
revised Add Standard Page Attributes Metabox for Page Parent
added 1305 characters in body
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
29
awarded  Editor
Jan
29
revised Add Standard Page Attributes Metabox for Page Parent
deleted 174 characters in body
Jan
29
asked Add Standard Page Attributes Metabox for Page Parent
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!
Jan
28
awarded  Student