I have created a admin menu in wordpress, and it is a main menu, I do have one parent page and also associated with that there are some child pages. I want to get the images of that child pages needs to be displayed in the menu also, links to the child pages like button. How can i do this in wordpress? wp_get_nav_menu_items function.
structure is below.
Parent-A
some description of parent-A page
child-A->child-A page feature Image and two buttons
child-B->child-B page feature Image and two buttons
child-C->child-C page feature Image and two buttons
Parent-B
some description of parent-B page
child-D -> child-D page feature Image and two buttons
child-E -> child-E page feature Image and two buttons
child-F -> child-F page feature Image and two buttons
I have created a admin menu in wordpress, and it is a main menu, I do have one parent page and also associated with that there are some child pages. I want to get the images of that child pages needs to be displayed in the menu also, links to the child pages like button. How can i do this in wordpress? wp_get_nav_menu_items function.
structure is below.
Parent-A
some description of parent-A page
child-A->child-A page feature Image and two buttons
child-B->child-B page feature Image and two buttons
child-C->child-C page feature Image and two buttons
Parent-B
some description of parent-B page
child-D -> child-D page feature Image and two buttons
child-E -> child-E page feature Image and two buttons
child-F -> child-F page feature Image and two buttons
WordPress has some functions to help work with lists of objects. These are especially helpful when working with the nav menu objects or the query object.
wp_filter_object_list()
takes an array of objects and filters them by a given set of criteria. You get a result that only contains objects that match your criteria.
Once you get a list of the menu items you'd like to loop through, you can check conditions to output different things. For example, what's the depth? What is the parent post id? etc. After that, grab the relevant information from the associated post id.
I hope that helps.