• Normally setting the post_type to ‘post’ would exclude other post types but it does not work in my case.

    <?php $args = array('post_type' => 'posts', 'posts_per_page' => 3); $lastposts = get_posts( $args ); foreach($lastposts as $post) : setup_postdata($post); ?>

    I have used this code to show my latest 3 regular blog entries, but the custom post type ‘slideshow’ keeps showing up. Am I doing something wrong here or is it my custom post registration?

    /* Register Slideshow */
    add_action('init', 'slideshow_init');
    function slideshow_init() {
    	$labels = array(
    		'name' => _x('Slideshow', 'post type general name'),
    		'singular_name' => _x('Slideshow', 'post type singular name'),
    		'add_new' => _x('Voeg slide toe', 'slide'),
    		'add_new_item' => __('Voeg slide toe'),
    		'edit_item' => __('Pas slide aan'),
    		'new_item' => __('Nieuwe slide'),
    		'view_item' => __('Bekijk slideshow'),
    		'search_items' => __('Zoek slides'),
    		'not_found' => __('Geen slides gevonden'),
    		'not_found_in_trash' => __('Geen slides gevonden in de prullebak'),
    		'parent_item_colon' => '',
    		'menu_name' => 'Slideshow'
    	);
    	$args = array(
    		'labels' => $labels,
    		'public' => true,
    		'publicly_queryable' => true,
    		'show_ui' => true,
    		'show_in_menu' => true,
    		'query_var' => true,
    		'menu_icon' => get_stylesheet_directory_uri() . '/images/slideshowtump.png',
    		'rewrite' => true,
    		'capability_type' => 'post',
    		'has_archive' => true,
    		'hierarchical' => false,
    		'menu_position' => null,
    		'supports' => array('title', 'editor', 'thumbnail')
    	);
    	register_post_type('slideshow', $args);
    }

The topic ‘Exclude customer post types from "Latest posts"’ is closed to new replies.