$ wpdb-> get_var自定义字段wordpress问题

时间:2018-11-20 20:56:36

标签: wordpress wordpress-theming

我想运行一个代码序列,就像下面给出的有关wordpress的示例一样,但是我有2个自定义字段,如何按以下顺序运行它们。此外,我最后添加的主题ID也已正确添加。

谢谢。

对不起,英语不好。

$post_type = 'episodes';
$post_if = $wpdb->get_var("SELECT count(post_id) FROM $wpdb->posts WHERE post_type = '".$post_type."' AND meta_key_season='.$d->season.' AND meta_key_episode'.$d->episode.' AND post_id='.$id.'");
    if($post_if > 0){
            // This post is available on the site.
        } else {
            // This Post is not on the site
     }

0 个答案:

没有答案