Support » Fixing WordPress » Custom post_type Replaced My WordPress Pages

  • I’m no expert with php, but I’ve been getting better and better whilst creating custom WP themes for clients. So while I’m very competent with the front-end of things, please forgive my shortcomings with the php side.

    Here’s the issue:

    I created a custom post_type “guide” via the functions.php file in order to create “Destination Guides” for my client. I went through the process or creating the post_type, added a custom taxonomy, worked it all into a template and it worked great.

    But then the content of the post_type “guide” appeared in every page where I used <?php the_content('<p>Read the rest of this page &raquo;</p>'); ?>

    Please help! I’m clueless as to what the issue may be, but any help would be much appreciated.

    Here’s the markup I used to register the custom post_type:

    /* START POST_TYPE GUIDE */
    
    add_action('init', 'guide_register');
    
    function guide_register() {
    
    	$labels = array(
    		'name' => _x('Destination Guides', 'post type general name'),
    		'singular_name' => _x('Destination Guides', 'post type singular name'),
    		'add_new' => _x('Add New Guide', 'portfolio item'),
    		'add_new_item' => __('Add New Destination Guide'),
    		'edit_item' => __('Edit Destination Guide'),
    		'new_item' => __('New Guide'),
    		'view_item' => __('View Guide'),
    		'search_items' => __('Search Guides'),
    		'not_found' =>  __('Nothing found'),
    		'not_found_in_trash' => __('Nothing found in Trash'),
    		'parent_item_colon' => ''
    	);
    
    	$args = array(
    		'labels' => $labels,
    		'public' => true,
    		'publicly_queryable' => true,
    		'show_ui' => true,
    		'query_var' => true,
    		'rewrite' => array('slug' => 'travel/destination-guides'),
    		'capability_type' => 'post',
    		'hierarchical' => true,
    		'menu_position' => 5,
    		'supports' => array('title','editor','thumbnail')
    	  ); 
    
    	register_post_type( 'guide', $args );
    
    	register_taxonomy("Continents", array("guide"), array("hierarchical" => true, "label" => "Continents", "singular_label" => "Continent", "rewrite" => true));
    
    }
    
    /* END POST_TYPE GUIDE */
  • The topic ‘Custom post_type Replaced My WordPress Pages’ is closed to new replies.