• Hello,

    So I am setting up a custom WordPress theme using two custom post types Articles and News. Each one is also using a custom single-post.php page single-articles.php and single-news.php. But after pulling the article posts on the main page and inserting their permalink into a ‘Read more’ link when I click on one of the article’s links it takes me to their permalink URL but instead of displaying the article post it displays the News post content. Both single-articles.php and single-news.php are in the themes folder, not in a subfolder.

    Here is an example of how I’m setting up the custom posts…

    add_action( 'init', 'articles_custom_postypes' );
    function articles_custom_postypes() {
    	$args = array (
    	'label' => $labels,
    	'public' => true,
        'menu_position' => 100,
    	'menu_icon' => 'dashicons-format-aside',
    	'label' => 'Articles',
        'has_archive' => false,
    	'supports' => array( 'title','editor', 'thumbnail'),
    
    );
    
    	register_post_type( 'articles', $args);
    
    }

    On the custom single post pages I am just calling the_title(), the_content, etc. Should I be using a while loop or something? Any advice would be awesome. Thanks!

  • The topic ‘Custom single-post pulling from wrong custom post type.’ is closed to new replies.