我想在我的主页显示滑块第二条件......这种说法<?php include (TEMPLATEPATH . '/featured-narrow.php'); ?>
使我得到一个滑块..无法achiev在if语句
我发现下面的代码在我home.php
:
<?php if (get_post_meta($postid, 'post_featcontent', true) == "Yes") { ?>
<?php include (TEMPLATEPATH . '/featured-vids.php'); ?>
<?php } ?
我敢肯定,如果我改变这种状况,我能显示一个滑块......
在其实,“如果”语句,我需要2个条件:a)检查主页和b )它遇到了“post_featcontent”的值等于“N”的条件箭头宽度特色内容滑块” ......
我试过如下:
if (is_front_page() && get_post_meta($postid, 'post_featcontent', true) == "Narrow Width Featured Content Slider")
我能够有成功的),但我无法实现对于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")),
);
你为get_post_meta(...)得到了什么print_r()? – toxicate20
使用PHPmyAdmin或任何您使用的方式检查数据库,请检查wp_postmeta表,了解post_featcontent的值是...或print_r它。很有可能这个定制元的价值不是你想象的那样。 –
@ toxicate20&@ShawnWernig +1。我建议当OP在[stackoverflow.com/questions/13498265/retreive-value-from-array-of-array](Http://stackoverflow.com/questions/13498265/)中提出同样的确切问题时,做类似的事情从数组中取得数值),现在'关闭' – Sean