0

我正在尝试在我的主页上显示一个滑块......这个声明<?php include (TEMPLATEPATH . '/featured-narrow.php'); ?> 让我得到一个滑块......

我在我的以下代码中找到了home.php

<?php if ( get_post_meta( $postid, 'post_featcontent', true ) == "Yes" ) { ?>
                <?php include (TEMPLATEPATH . '/featured-vids.php'); ?>
            <?php } ?

我很确定如果我改变这个条件,我可以显示一个滑块......

实际上在那个'if'语句中,我需要两个条件:a)检查主页和b)它满足'post_featcontent'的值等于“窄宽度特色内容滑块”的条件......

我尝试如下:

if ( is_front_page() && get_post_meta( $postid, 'post_featcontent', true ) == "Narrow Width Featured Content Slider" ) 

我能够通过 a) 取得成功,但无法达到 b) 的条件(顺便说一句,这是一个 WordPress ..,但我觉得这只是一个 PHP 怀疑..)

有人可以帮忙吗..?

编辑:

$meta_boxes = array(

        "layout" => array(
            "name" => "layout",
            "type" => "select",
            "title" => __("Page Layout", "solostream"),
            "description" => __("Select a layout for this page/post.", "solostream"),


        "post_featcontent" => array(
            "name" => "post_featcontent",
            "type" => "select",
            "title" => __("Add Featured Articles/Posts to This Post", "solostream"),
            "description" => __("If you'd like to add featured articles/posts to the top of this post, make your selection below.", "solostream"),
            "options" => array(
                    "No", 
                    "Full Width Featured Content Slider", 
                    "Narrow Width Featured Content Slider")),

);
4

1 回答 1

-1

更改您的 if 语句以包含另一组括号

if ( (is_front_page()) && (get_post_meta( $postid, 'post_featcontent', true) == "Narrow Width Featured Content Slider") 
   ){

本质上,您希望将每个条件分开以满足特定标准,

即: if((this=this) && (this=this))

为了继续,两个条件都需要为真,为此,您将每个条件都用括号括起来,然后用另一组括号封装两者。

于 2012-11-22T16:56:48.127 回答