你的问题很小,但我会试一试。
您需要为您的值添加一个元框打开save_post
将数据保存到$wpdb->postmeta
使用pre_get_posts
和/或posts_where
根据需要非常基本的代码大纲:
function generic_box() {
add_meta_box(
\'generic_box\', // id, used as the html id att
__( \'Generic Title\' ), // meta box title
\'generic_cb\', // callback function, spits out the content
\'post\', // post type or page. This adds to posts only
\'side\', // context, where on the screen
\'low\' // priority, where should this go in the context
);
}
function generic_cb() {
echo \'generic content\';
}
add_action( \'add_meta_boxes\', \'generic_box\' );
function generic_save($post_id) {
// use $post_id and the global $_POST variable to process information
// use update_post_meta() to save information
}
add_action(\'save_post\',\'generic_save\');
function generic_pre_get_posts($qry) {
if (is_feed()) {
// alter your query
}
}
add_action(\'pre_get_posts\',\'generic_pre_get_posts\');