forked from jbrad/standard
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtemplate-sitemap.php
120 lines (100 loc) · 3.73 KB
/
template-sitemap.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
/**
* Template Name: Sitemap
*
* The template for rendering an SEO-friendly site map.
*
* @package Standard
* @since 3.0
* @version 3.1
*/
?>
<?php get_header(); ?>
<?php $presentation_options = get_option( 'standard_theme_presentation_options' ); ?>
<div id="wrapper">
<div class="container">
<div class="row">
<?php if ( 'left_sidebar_layout' == $presentation_options['layout'] ) { ?>
<?php get_sidebar(); ?>
<?php } // end if ?>
<div id="main" class="<?php echo 'full_width_layout' == $presentation_options['layout'] ? 'span12 fullwidth' : 'span8'; ?> clearfix" role="main">
<?php get_template_part( 'breadcrumbs' ); ?>
<?php if ( have_posts() ) { ?>
<?php while ( have_posts() ) { ?>
<?php the_post(); ?>
<div id="post-<?php the_ID(); ?> format-standard" <?php post_class( 'post' ); ?>>
<div class="post-header clearfix">
<h1 class="post-title entry-title"><?php the_title(); ?></h1>
</div><!-- /.post-header -->
<div id="content-<?php the_ID(); ?>" class="entry-content clearfix">
<div id="sitemap-authors">
<h2 id="authors"><?php _e( 'Authors', 'standard' ); ?></h2>
<ul id="sitemap-authors" class="inline-grid four-up">
<?php
foreach( get_users() as $user ) {
$query = new WP_Query( 'author=' . $user->ID . '&posts_per_page=1' );
if( $query->have_posts() ) {
echo '<li>';
echo '<div class="sitemap-author-meta">';
echo get_avatar( $user->user_email, $size = '80' );
$query->the_post();
echo '<span class="badge">';
the_author_posts();
echo '</span>';
echo '<br>';
the_author_posts_link();
echo '</div>';
echo '</li>';
} // end if
wp_reset_postdata();
} // end foreach
?>
</ul>
</div><!-- /#sitemap-authors -->
<h2 id="pages"><?php _e( 'Pages', 'standard' ); ?></h2>
<ul id="sitemap-pages">
<?php
wp_list_pages(
array(
'exclude' => get_the_ID(),
'title_li' => '',
)
);
?>
</ul>
<h2 id="posts"><?php _e( 'Posts', 'standard' ); ?></h2>
<ul id="sitemap-posts">
<?php
$category_list = '';
foreach ( get_categories() as $category ) {
$category_list .= '<li><h3>' . $category->cat_name . '</h3></li>';
$category_list .= '<ul>';
$category_query = new WP_Query( 'posts_per_page=-1&cat=' . $category->cat_ID );
if( $category_query->have_posts() ) {
while( $category_query->have_posts() ) {
$category_query->the_post();
$cat = get_the_category();
if ( '' != get_the_title() ) {
$category_list .= '<li><a href="' . get_permalink() . '">' . get_the_title() . '</a></li>';
} // end if
} // end while
$category_list .= '</ul>';
$category_list .= '</li>';
} // end if
} // end foreach
wp_reset_postdata();
echo $category_list;
?>
</ul>
</div><!-- /.entry-content -->
</div> <!-- /#post -->
<?php } // end while ?>
<?php } // end if ?>
</div><!-- /#main -->
<?php if ( 'right_sidebar_layout' == $presentation_options['layout'] ) { ?>
<?php get_sidebar(); ?>
<?php } // end if ?>
</div><!--/ row -->
</div><!--/container -->
</div> <!-- /#wrapper -->
<?php get_footer(); ?>