Adding multiple post queries with parent and children to page – Best Way

So I am interested in allowing a custom menu to show “in three places: Menu area, Homepage body, and footer” based on the posttype “page” table list or parent and children entries and not using the WP nav menu system.

Reason is, I want users to control the menus displaying of my site using custom fields on each page. All 3 menus on the site will parent titles (w/ children page titles in the header menu only), but all with “different styling” done to each of the 3 sections.

I will make the function a shortcode
[mycustommenu area=”header | body | footer”] which will allow me to pass args as var into my function.

So my questions are:

Should I use WP_Query or the get_posts / get_children function for this?

Should I run multiple loops separated by if statements if(atts[‘header’]): or should I just do 1 loop and separate the object->results with the if statements?

Just looking for the best solution in terms of optimization. And IF there is a better way to do this all together, please let me know 🙂

Read more here:: Adding multiple post queries with parent and children to page – Best Way

Leave a Reply

Your email address will not be published. Required fields are marked *