Curly braces for foreach
is missing. Try this:
/*
Template Name: Directory
*/
add_action( 'genesis_entry_content', 'ogs_directory', 5 );
function ogs_directory() {
$args = array(
'blog_id' => 1, // unless yours is a multisite install, you shouldn't need to change this
'exclude' => array(), // IDs of users that need to be excluded
'orderby' => 'display_name' // Sort by 'ID', 'login', 'nicename', 'email', 'url', 'registered', 'display_name', or 'post_count'; defaults to 'login'
);
$members = get_users( $args );
if( rcp_is_active() ) {
foreach ($members as $member) {
echo '<p>';
echo '<strong>Name: </strong>' .esc_attr( $member->first_name ). '' ;
echo '<strong> </strong>' .esc_attr( $member->last_name ). '<br/> ' ;
if ( $member->rcp_address ) {
echo '<strong>Address: </strong>' .esc_attr( $member->rcp_address ). '<br/> ' ;
}
if ( $member->rcp_univ_1 ) {
echo '<strong>University: </strong>' .esc_attr( $member->rcp_univ_1 ). '<br/> ' ;
}
echo '</p>';
} // end foreach
} // end if
} // end function
//* Run the Genesis loop
genesis();