[Plugin: WP Realtime Sitemap] mod to select specific custom posts
-
this might be a good way to display only specific custom post types rather than all or none…
so the shortcode for any specific custom post type would be:
[wp-realtime-sitemap show=”put your custom post name here”]basically i replaced the entire custom post types yes/no if statement with the following:
$post_types = get_post_types(array('public' => true, '_builtin' => false), 'objects'); foreach($post_types as $post_type) { if($show == $post_type->name) { $custom_post_type_posts = ''; // Set options for post query $theposts = get_posts(array( 'numberposts' => $post_numberposts, 'orderby' => $post_orderby, 'order' => $post_order, 'exclude' => $post_exclude, 'post_type' => $post_type->name, )); if (count($theposts) > 0) { foreach((array)$theposts as $post) { setup_postdata($post); $extra = ''; if ($post_show_date == 'Yes') $extra = ' <span>' . get_the_date() . '</span>'; $custom_post_type_posts .= '<li><a href="' . get_permalink() . '" title="' . sprintf(esc_attr__('Permalink to %s', 'wp-realtime-sitemap'), the_title_attribute('echo=0')) . '" rel="bookmark">' . get_the_title() . '</a>' . $extra . '</li>'; } wp_reset_postdata(); $custom_post_types[$post_type->name] = '<div id="wp-realtime-sitemap-' . strtolower($post_type->name) . '"><h3>' . $post_type->labels->name . '</h3><ul>' . $custom_post_type_posts . '</ul></div>'; } } } if($custom_post_types) return implode('', $custom_post_types);
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘[Plugin: WP Realtime Sitemap] mod to select specific custom posts’ is closed to new replies.