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

People list and az #142

Merged
merged 2 commits into from Jul 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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