I have lots of subpages each having some custom fields.
I am using 2 plugins, eMembers for the membership levels, and Types for my custom fields.
I am trying to show the custom field information on the parent page. I have my code working fine. But then I tried to pull in the same data again but only show the ones with a certain checkbox ticked. I have that working as well.
But my problem is when I try and run both scripts at the same time. I only get the first script results to show.
my code is 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
/////
-->
Cheers Jord