Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
42ed949a36
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
109 lines (103 sloc) 3.66 KB
<?php
/**
* The template used for displaying page content in page.php
*
* @package cornerstone
*/
$exclude = get_post_meta(get_the_ID(), 'exclude', 'true');
$pattern = '#[A-Za-z|~`!@\#$%^&*()_+=|\\}\][{\'/;\-":?>.<]#';
?>
<article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?>>
<header class="entry-header">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
</header><!-- .entry-header -->
<div class="entry-content">
<?php the_content(); ?>
<?php
wp_link_pages( array(
'before' => '<div class="page-links">' . __( 'Pages:', 'cs' ),
'after' => '</div>',
) );
?>
</div><!-- .entry-content -->
<div id="az-index" class="clearfix">
<?php
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);
if($parent !== false) $page = $parent;
else $page = $pg->ID;
$private = get_post_meta($page, 'uc-private', true);
if($private == 'admins' || $private == 'users' || $private == 'list'){
continue;
}
$title = ucwords($pg->post_title);
$char = $title{0};
//if($char == 'Z') echo $title;
if(!in_array($char, $letters) ){
array_push($letters, $char);
}
}
return $letters;
}
// Generate AZ Navigation
echo '<nav class="btn-group">';
$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>';
?>
<input id="azFilterInput" type="text" class="form-control" aria-label="search site A to Z" placeholder="Type here to filter this list" />
<?php
// Generate AZ List
//if( !preg_match($pattern, $exclude, $matches) ){
$letters = array();
echo '<section class="letter-directory">';
foreach( (array) $pages as $pg ){
$parent = is_parent_private($pg->ID);
if($parent !== false) $page = $parent;
else $page = $pg->ID;
$private = get_post_meta($page, 'uc-private', true);
if($private == 'admins' || $private == 'users' || $private == 'list'){
continue;
}
$title = ucwords($pg->post_title);
$char = $title{0};
if( !( empty($char) ) ){
if( $char != end($letters) && !empty($letters) ){
echo '</ol></div>';
}
if( !in_array($char, $letters) ){
echo '<div class="az-letter"><a name="'.$char.'-pages" class="az-anchor"></a><h2 id="'.$char.'-pages" class="az-letter-title"><span class="az-letter">'.$char.'</span></h2><ol class="az-letter-list">';
array_push($letters, $char);
}
echo '<li><a href="'.get_page_link($pg->ID).'" class="az-letter-page">'.$title.'</a></li>';
}
}
echo '</ol></div></section>';
//} else {
// echo '<p>Invalid input in field: "exclude"</p>';
//}
?>
</div>
<footer class="entry-footer">
<?php edit_post_link( __( 'Edit', 'cs' ), '<span class="edit-link">', '</span>' ); ?>
</footer><!-- .entry-footer -->
</article><!-- #post-## -->