Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #142 from jmr06005/master
People list and az
  • Loading branch information
jmr06005 committed Jul 5, 2016
2 parents 3dc6260 + 9453573 commit 118dd84
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
30 changes: 20 additions & 10 deletions content-az.php
Expand Up @@ -27,8 +27,9 @@ $pattern = '#[A-Za-z|~`!@\#$%^&*()_+=|\\}\][{\'/;\-":?>.<]#';

<div id="az-index" class="clearfix">
<?php
function getChars(){
$pages = get_pages();
function getChars($pages){
global $exclude;
//$pages = get_pages(array('sort_order' => 'asc', 'sort_column' => 'post_title', 'hierarchical' => false, 'exclude' => $exclude));
$letters = array();
foreach( (array) $pages as $pg ){
$parent = is_parent_private($pg->ID);
Expand All @@ -40,7 +41,8 @@ $pattern = '#[A-Za-z|~`!@\#$%^&*()_+=|\\}\][{\'/;\-":?>.<]#';
}
$title = ucwords($pg->post_title);
$char = $title{0};
if( !(is_numeric($char)) && !in_array($char, $letters) ){
if($char == 'Z') echo $title;
if(!in_array($char, $letters) ){
array_push($letters, $char);
}
}
Expand All @@ -49,19 +51,27 @@ $pattern = '#[A-Za-z|~`!@\#$%^&*()_+=|\\}\][{\'/;\-":?>.<]#';

// Generate AZ Navigation
echo '<nav class="btn-group">';
$anchors = getChars();
$pages = get_pages(array('sort_order' => 'asc', 'sort_column' => 'post_title', 'hierarchical' => false, 'exclude' => $exclude));
$anchors = getChars($pages);
foreach( range('A', 'Z') as $char ){
if( in_array( $char, $anchors ) ){
echo '<a href="#'.$char.'-pages" class="btn btn-default">'.$char.'</a>';
} else {
echo '<span class="btn btn-default disabled">'.$char.'</span>';
}
}
echo '</nav><nav class="btn-group">';
foreach( range('0', '9') as $char ){
if( in_array( (string)$char, $anchors ) ){
echo '<a href="#'.$char.'-pages" class="btn btn-default">'.$char.'</a>';
} else {
echo '<span class="btn btn-default disabled">'.$char.'</span>';
}
}
echo '</nav>';

// Generate AZ List
$pages = get_pages(array('sort_order' => 'asc', 'sort_column' => 'post_title', 'hierarchical' => false, 'exclude' => $exclude));
if( !preg_match($pattern, $exclude, $matches) ){
//if( !preg_match($pattern, $exclude, $matches) ){
$letters = array();
echo '<section class="letter-directory">';
foreach( (array) $pages as $pg ){
Expand All @@ -74,7 +84,7 @@ $pattern = '#[A-Za-z|~`!@\#$%^&*()_+=|\\}\][{\'/;\-":?>.<]#';
}
$title = ucwords($pg->post_title);
$char = $title{0};
if( !( is_numeric($char) || empty($char) ) ){
if( !( empty($char) ) ){
if( $char != end($letters) && !empty($letters) ){
echo '</ol></div>';
}
Expand All @@ -86,9 +96,9 @@ $pattern = '#[A-Za-z|~`!@\#$%^&*()_+=|\\}\][{\'/;\-":?>.<]#';
}
}
echo '</ol></div></section>';
} else {
echo '<p>Invalid input in field: "exclude"</p>';
}
//} else {
// echo '<p>Invalid input in field: "exclude"</p>';
//}
?>
</div>
<footer class="entry-footer">
Expand Down
2 changes: 2 additions & 0 deletions user-people.php
Expand Up @@ -25,6 +25,7 @@ get_header(); ?>
</footer><!-- .entry-footer -->
<div class="uc-people">
<?php
if(! post_password_required()){
// everything we'll be doing will go into the args for WP_query.

//$args = array('post_type=person');
Expand Down Expand Up @@ -184,6 +185,7 @@ get_header(); ?>
}

}
}
?>


Expand Down

0 comments on commit 118dd84

Please sign in to comment.