我正在寻找一些与wpdb相关的帮助,以比较和更改某些值。我是mysql处理方面的新手,所以我非常感谢您在这方面的帮助!
我想做的是通过wp db查找与$page_id
. 找到帖子后,应检查menu_order
值并将其与$page_order
. 如果它们相同,则什么也不做,但如果它们不匹配,则应设置menu_order
价值$page_order
.
下面是一些伪代码:
$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;
}
}
}
感谢所有帮助!
谢谢