Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

maustin89 on "Exclude a custom post type from HTML sitemap"

$
0
0

Hi guys, I created a page template for an HTML sitemap based on Yoast's post here: http://yoast.com/html-sitemap-wordpress/

The below snippet is used to display custom post types in the sitemap:

<?php
foreach( get_post_types( array('public' => true) ) as $post_type ) {
  if ( in_array( $post_type, array('post','page','attachment') ) )
    continue;

  $pt = get_post_type_object( $post_type );

  echo '<h2>'.$pt->labels->name.'</h2>';
  echo '<ul>';

  query_posts('post_type='.$post_type.'&posts_per_page=-1');
  while( have_posts() ) {
    the_post();
    echo '<li><a href="'.get_permalink().'">'.get_the_title().'</a></li>';
  }

  echo '</ul>';
}

My problem is I'm using the WCK CPT Creator plugin and it apparently auto-generates a post type for custom meta boxes, because I'm getting a "WCK Custom Meta Boxes" section at the bottom of my sitemap below the other CPTs. I can't see any way to remove this in the plugin's interface. Can anyone suggest how to modify the above code to exclude a given post type?

Thanks!


Viewing all articles
Browse latest Browse all 8245

Trending Articles