我有一个数字,我想将其与某个类别的所有帖子ID进行比较。
<?php
$CustomNumber = "13237";
if( $post_ids == $CustomNumber ): ?>
//Exist
<?php else: ?>
//Doesn\'t exist
<?php endif; ?>
自定义编号将从输入中给定。。。所以我让你更容易理解我想要实现的目标。我有一个数字,我想将其与某个类别的所有帖子ID进行比较。
<?php
$CustomNumber = "13237";
if( $post_ids == $CustomNumber ): ?>
//Exist
<?php else: ?>
//Doesn\'t exist
<?php endif; ?>
自定义编号将从输入中给定。。。所以我让你更容易理解我想要实现的目标。我找到了解决方案
<?php
$costumepost = "12709";
// args
$args = array(
\'numberposts\' => -1,
\'post_type\' => \'post\',
\'cat\' => array(18),
\'meta_query\' => array(
\'relation\' => \'AND\',
array(
\'key\' => \'costumeid\',
\'value\' => $costumepost,
\'compare\' => \'=\'
),
)
);
// query
$the_query = new WP_Query( $args );
?>
<?php if( $the_query->have_posts() ): ?>
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<?php echo get_post_meta($post->ID, \'artist\', true); ?><br>
<?php endwhile; ?>
<?php endif; ?>
<?php wp_reset_query();?>
我遵循wordpress codex网站上关于通过插件创建管理主题的说明。我激活了插件,但我的样式表没有包含在<head>.. 这是我的代码:add_action( \'admin_init\', \'kd_plugin_admin_init\' ); add_action( \'admin_menu\', \'kd_plugin_admin_menu\' ); function kd_plugin_admin_init() { /* Register