-
-
Save kalenjohnson/5c0a32bb05fa855c706e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="primary" class="content-area site-archives col-xs-12"> | |
<?php if( function_exists('bcn_display') ) { | |
bcn_display(); | |
} ?> | |
<main id="main" class="site-main" role="main"> | |
<?php while ( have_posts() ) : the_post(); | |
get_template_part( 'content', 'page' ); | |
// If comments are open or we have at least one comment, load up the comment template | |
if ( comments_open() || '0' != get_comments_number() ) : | |
comments_template(); | |
endif; | |
endwhile; // end of the loop. ?> | |
<h3 class="page-header">Categories</h3> | |
<ul class="row category-archive"> | |
<?php $categories = get_categories( array('hierarchical'=>0) ); | |
foreach ($categories as $category) { | |
$option = '<li class="col-xs-6 col-md-4"><a href="'.get_category_link( $category ).'">'; | |
$option .= $category->cat_name; | |
$option .= '</a>'; | |
$option .= ' ('.$category->category_count.')</li>'; | |
echo $option; | |
} | |
?> | |
</ul> | |
<h3 class="page-header">Tags</h3> | |
<?php $list = ''; | |
$tags = get_terms( 'post_tag' ); | |
$groups = array(); | |
if( $tags && is_array( $tags ) ) { | |
foreach( $tags as $tag ) { | |
$first_letter = strtoupper( $tag->name[0] ); | |
$groups[ $first_letter ][] = $tag; | |
} | |
if( !empty( $groups ) ) { | |
foreach( $groups as $letter => $tags ) { | |
$list .= "\n\t" . '<h4>' . apply_filters( 'the_title', $letter ) . '</h4>'; | |
$list .= "\n\t" . '<ul class="row tag-archive tag-'.$letter.'">'; | |
foreach( $tags as $tag ) { | |
$url = esc_attr( get_tag_link( $tag->term_id ) ); | |
$count = intval( $tag->count ); | |
$name = apply_filters( 'the_title', $tag->name ); | |
$list .= "\n\t\t" . '<li class="col-xs-6 col-md-4"><a href="' . $url . '">' . $name . '</a> (' . $count . ')</li>'; | |
} | |
$list .= "\n\t" . '</ul>'; | |
} | |
} | |
}else $list .= "\n\t" . '<p>Sorry, but no tags were found</p>'; | |
$tags = get_tags(); | |
$html = ''; | |
foreach ($tags as $tag){ | |
$tag_link = get_tag_link($tag->term_id); | |
$html .= "<li><a href='{$tag_link}' title='{$tag->name} Tag' class='{$tag->slug}'>"; | |
$html .= "{$tag->name}</a></li>"; | |
} | |
$html .= ''; | |
echo $list; ?> | |
</main><!-- #main --> | |
</div><!-- #primary --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment