• First of all, thanks for your theme, it is very great !

    I use a plugin where I have an checkbox option in wp admin option which allows to show posts as blog post in home and archive pages. These posts are specifics because they have an other post type than ‘post’ (For your understanding I will call them “new post type” post on my message).

    When I accept this checkbox option, my home page is strange.
    I see my posts + “new post type” posts + a lot of posts which content just some characters (these characters have nothing to do here. I think it is characters which composed my menu)

    For information, the function used to show “new post type” posts in blog is :

    // add post types to the homepage and archive listings
    	static function query_post_type($query) {
    		if(!get_option('show_new_post_type_in_blog')) return $query;
    
    		if ( (is_home() or is_archive()) and $query->is_main_query() ) {
    			$post_types = @$query->query_vars['post_type'];
    
    			// empty, so we'll have to create post_type setting
    			if(empty($post_types)) {
    				if(is_home()) $post_types = array('post', 'nav_menu_item', 'new_post_type');
    				else $post_types = array('post', 'nav_menu_item', 'new_post_type');
    			}
    
    			// not empty, so let's just add
    			if(!empty($post_types) and is_array($post_types)) {
    				$post_types[] = 'new_post_type';
    				$query->set( 'post_type', $post_types );
    			}
    		}
    		return $query;
    	}

    My main issue is posts contening these characters. After having tested, I know it is ‘nav_menu_item’ which cause this issue but I don’t understand why there is this behaviour and how solved it.
    When I delete ‘nav_menu-item’ in array these strange posts are no longer display (cool !) but my header menu is no longer display too.

    So I don’t know how to stop displaying of strange posts and at the same time having header menu displayed.
    If you have any clues to help me it’s will be great.

    Thanks for your time
    Romain

  • The topic ‘Home page / new post type : Display issue’ is closed to new replies.