我想查询日期名称,来自分类jadwal
:
get name day like WEDNESDAY from $day
我的WP_Query代码是:
$day = date("l");
$args = array('post_type' => 'post',
'post__not_in' => array( get_the_ID() ),
'posts_per_page' => 1,
'jadwal' => $day,
'meta_query' => array(array()));
$query = new WP_Query( $args );
if( $query->have_posts() ) : while( $query->have_posts() ) : $query->the_post();
#extract data
endwhile; endif; wp_reset_postdata();
我的分类代码
add_action('init', 'cptui_register_my_taxes_jadwal');
function cptui_register_my_taxes_jadwal() {
register_taxonomy( 'jadwal',array (
0 => 'post',
),
array( 'hierarchical' => false,'label' => 'Pilih Jadwal','show_ui' => true,'query_var' => true,'show_admin_column' => false,'labels' => array ('search_items' => 'Pilih Jadwal','popular_items' => 'Popular Jadwal','all_items' => 'All Jadwal','parent_item' => 'Parent Jadwal','parent_item_colon' => 'Parent Jadwal:','edit_item' => 'Edit Jadwal','update_item' => 'Update Jadwal','add_new_item' => 'Add New Jadwal','new_item_name' => 'New Jadwal Name','separate_items_with_commas' => '','add_or_remove_items' => '','choose_from_most_used' => '',)) );
}