I'm looking for some help tying in with the wpdb to compare and change certain values. I'm very novice with mysql handling so I really appreciate any help on this matter!
What I want to do is to go through the wp db looking for a post same id as $page_id
. When the post is found it should check the menu_order
value and compare it to $page_order
. If they're the same, then do nothing, but if they don't match it should set menu_order
to the value of $page_order
.
Here's some pseudo code:
$page_id = 45;
$page_order = 1;
if(post_id == $page_id) {
if(menu_order != $page_order) {
set menu_order to $page_order
switch($page_order) {
case "1":
set post meta "color_dropdown" as "pink"
if have child pages set post meta "color_dropdown" as "pink" to them aswell
break;
}
}
}
All help appreciated!
Thanks
wp_list_pages