-
Notifications
You must be signed in to change notification settings - Fork 0
/
template-sitemap.php
107 lines (83 loc) · 3.7 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
<?php
/**
* Template Name: Sitemap
*
* The sitemap page template displays a user-friendly overview
* of the content of your website.
*
* @package WooFramework
* @subpackage Template
*/
global $woo_options;
get_header();
?>
<!-- #content Starts -->
<?php woo_content_before(); ?>
<div id="content" class="col-full">
<div id="main-sidebar-container">
<!-- #main Starts -->
<?php woo_main_before(); ?>
<section id="main">
<?php woo_loop_before(); ?>
<!-- Post Starts -->
<?php woo_post_before(); ?>
<article class="post">
<?php woo_post_inside_before(); ?>
<h1 class="title"><?php the_title(); ?></h1>
<section class="entry">
<h3><?php _e( 'Pages', 'woothemes' ); ?></h3>
<ul>
<?php wp_list_pages( 'depth=0&sort_column=menu_order&title_li=' ); ?>
</ul>
<h3><?php _e( 'Categories', 'woothemes' ); ?></h3>
<ul>
<?php wp_list_categories( 'title_li=&hierarchical=0&show_count=1' ); ?>
</ul>
<h3><?php _e( 'Posts per category', 'woothemes' ); ?></h3>
<?php
$cats = get_categories();
foreach ( $cats as $cat ) {
$loop = new WP_Query( array( 'cat' => intval( $cat->cat_ID ) ) );
?>
<h4><?php echo esc_html( $cat->cat_name ); ?></h4>
<ul>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<li style="font-weight:normal !important;"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> - <?php _e( 'Comments', 'woothemes' ); ?> (<?php echo $post->comment_count; ?>)</li>
<?php endwhile; ?>
</ul>
<?php } wp_reset_postdata(); ?>
<?php if ( is_woocommerce_activated() ): ?>
<h3><?php _e( 'Product Categories', 'woothemes' ); ?></h3>
<ul>
<?php wp_list_categories( 'taxonomy=product_cat&pad_counts=1&title_li=' ); ?>
</ul>
<h3><?php _e( 'Products', 'woothemes' ); ?></h3>
<ul>
<?php
$args = array( 'post_type' => 'product',
'posts_per_page' => -1,
'meta_query' => array ( array( 'key' => '_visibility',
'value' => array('catalog', 'visible'),
'compare' => 'IN'
))
);
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
?>
<li><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
<?php endwhile; ?>
</ul>
<?php endif; ?>
</section><!-- /.entry -->
<?php woo_post_inside_after(); ?>
</article><!-- /.post -->
<?php woo_post_after(); ?>
<div class="fix"></div>
</section><!-- /#main -->
<?php woo_main_after(); ?>
<?php get_sidebar(); ?>
</div><!-- /#main-sidebar-container -->
<?php get_sidebar( 'alt' ); ?>
</div><!-- /#content -->
<?php woo_content_after(); ?>
<?php get_footer(); ?>