有人知道如何在页面属性中插入ORDER编号吗?我只需要数字,如果没有设置,给我一个特定的数字(1,或任何我想要的)所有没有设置订单页码的页面.
谢谢!
我不确定你想要什么......
如果你想从帖子/页面中检索menu_order,你可以使用类似的东西
<?php
$id=1;
$default = 42;
get_post($id); //you can use any kind of query or use it in the loop
global $post;
if(empty($post->menu_order)) //if not set give the value you want
$post->menu_order = $default; //note that it won't update the value in the database
echo $post->menu_order;
wp_reset_query();
?>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9296 次 |
| 最近记录: |