我有很多子页面,每个子页面都有一些自定义字段。
我使用2个插件,成员级别使用eMember,自定义字段使用类型。
我试图在父页面上显示自定义字段信息。我的代码运行良好。但后来我又尝试再次拉入相同的数据,但只显示勾选了某个复选框的数据。我也能做到这一点。
但我的问题是,当我尝试同时运行这两个脚本时。我只得到要显示的第一个脚本结果。
我的代码是http://pastebin.com/vgeZwPxM
<!--
/////
START USER LOGGED IN
/////
-->
<?php if(wp_emember_is_member_logged_in()) { ?>
<!--
/////
START USER LOGGED IN - LEVEL PAID
/////
-->
<?php if(wp_emember_is_member_logged_in(2)) { ?>
<h3 class="grey">Top 3 In <?php wp_title(\'\'); ?></h3>
<?php
// Get the page\'s children
$top3 = get_pages(\'child_of=\'.$post->ID.\'&sort_column=menu_order&parent=\'.$post->ID);
if (!empty($top3)) { //check if there are any children pages.
//If there are....
global $post;
foreach($top3 as $post) {
$url = get_permalink($child->ID);
$title = get_the_title($child->ID);
$topThreeInArea = types_render_field("top-3-in-area", array("raw"=>"true","separator"=>";"));
$address = types_render_field("address", array("raw"=>"true","separator"=>";"));
if ( !empty( $topThreeInArea ) ) {
echo "<div class=\'col_3\'>";
echo "<h3><a href=\'".$url."\'>".$title."</a></h3>";
//If Address
if ( !empty( $address ) ) {
echo "<p><i class=\'icon-pin\'></i>";
echo "<span>".$address."</span></p>";
}
echo "<span>".$facilities."</span></p>";
}
echo "<a href=\'".$url."\' class=\'button green\'>Visit Website</a> ";
echo "</div>";
}
}
}
?>
<div class=\'clear\'></div>
<?php } ?>
<!--
/////
END USER LOGGED IN - LEVEL PAID
/////
-->
<div id="county-nav" class="listNav"></div>
<ul class="county " id="county">
<?php
// Get the page\'s children
$children = get_pages(\'child_of=\'.$post->ID.\'&sort_column=menu_order&parent=\'.$post->ID);
if (!empty($children)) { //check if there are any children pages.
//If there are....
global $post;
foreach($children as $post) {
$url = get_permalink($child->ID);
$title = get_the_title($child->ID);
$address = types_render_field("address", array("raw"=>"true","separator"=>";"));
echo "<li class=\'\'>";
echo "<h3><a href=\'".$url."\'>".$title."</a></h3>";
echo "<div class=\'col_2\'>";
//If Address
if ( !empty( $address ) ) {
echo "<p><i class=\'icon-pin\'></i>";
echo "<span>".$address."</span></p>";
}
echo "</div>";
echo "<div class=\'clear\'></div>";
echo "<a href=\'".$url."\' class=\'button green\'>Visit Website</a> ";
echo "</li>";
}
}
?>
</ul>
<?php } ?>
<!--
/////
END USER LOGGED IN
/////
-->
干杯词