Closed getdave closed 10 years ago
Revision
<?php
/*
Template Name: Sitemap
*/
get_header(); ?>
<div class="layout-1c">
<div class="column-container">
<div class="main" role="main">
<section class="container">
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'page' ); ?>
<?php endwhile; // end of the loop. ?>
<?php foreach( get_post_types( array('public' => true) ) as $post_type ) : ?>
<?php if ( !in_array( $post_type, array('post','attachment', 'welcome','homepage_slides','slider', 'technologies', 'jobs') ) ) : ?>
<?php
$args = array(
'post_type' => $post_type,
'posts_per_page' => '-1',
'orderby' => 'title',
'order' => 'ASC'
);
$custom_posts_obj = new WP_Query( $args );
?>
<?php if ( $custom_posts_obj->have_posts() ): ?>
<h2><?php echo get_post_type_object( $post_type )->labels->name; ?></h2>
<ul>
<?php while ( $custom_posts_obj->have_posts() ) : $custom_posts_obj->the_post(); ?>
<li><a href="<?php echo get_permalink(); ?>"><?php echo get_the_title(); ?></a></li>
<?php endwhile; ?>
</ul>
<?php endif; wp_reset_postdata(); ?>
<?php endif; ?>
<?php endforeach; ?>
</section>
</div><!-- .main -->
<div class="sub">
<?php get_sidebar();?>
</div>
</div>
</div>
<?php get_footer(); ?>
Looks ok to me.
Closed via 947f17b039ebb2c87189031d04a71a1beedcdcc5
Add a standard Sitemap template with the following content
Be sure to add additional CPTs to the exclusion list as required.
Be sure to name the template
page-sitemap
as this will avoid the need to set a template via the admin.Alternatively happy for this to become a Plugin wjich automagically creates a Sitemap page (if one doesn't exist) and then adds the sitemap to that page by hooking into the
the_content
hook and printing out after.When done please amend Prelaunch to match new requirements.