Skip to content

Instantly share code, notes, and snippets.

@ameeker
Last active August 29, 2015 14:02
Show Gist options
  • Save ameeker/58f8fbaeae5a5703dc11 to your computer and use it in GitHub Desktop.
Save ameeker/58f8fbaeae5a5703dc11 to your computer and use it in GitHub Desktop.
Members Directory (example) using Restrict Content Pro and Genesis
<?php
/**
* This file adds the User Directory template to the Parallax Pro Theme.
*
* @author StudioPress
* @package Parallax
* @subpackage Customizations
*/
/*
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>';
} }
//* Run the Genesis loop
genesis();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment