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"]
which will allow me to pass "header" attribute 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 :)
WP_Query
is the better route 9/10 times, with the exception of awp_admin_json
response. I'd also recommend using the following to manage the queryfunction manage_query($wp_query){var_export($wp_query);exit;/*your code goes here*/}add_action('pre_get_posts','manage_query');