Support » Fixing WordPress » Custom post types and p tags

  • Helloo,

    I have a little issue with my custom post types. I have set one up and used the default wordpress text editor box.

    All works except when I type and then do a return for another line wordpress just closes the gap. On a normal content page it puts each line of text inside a p tag. However my custom post type does not all content inside one set of p tags, no spaces.

    Any ideas?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Do you have a link to show or can you post the CPT code from your functions.php? Are you using a custom “posts.php” in your theme to display the new CPT?

    [ Signature moderated. ]

    Thread Starter obidos

    (@obidos)

    Hi there,

    I have the site running local at the moment but here is my functions.php file that creates the custom post type I’m talking about:

    <?php
    // CUSTOM POST TYPES //
    add_action('init', 'feature_init');
    function feature_init()
    {
    	//Default arguments
    	$args = array
    	(
    		'public' 				=> true,
    		'publicly_queryable'	=> true,
    		'show_ui' 				=> true,
    		'query_var' 			=> true,
    		'rewrite' 				=> true,
    		'capability_type' 		=> 'post',
    		'has_archive' 			=> true,
    		'hierarchical' 			=> false,
    		'menu_position' 		=> NULL,
    	);
    
    	$labels = array
    	(
    		'name' 					=> 'doctors',
    		'singular_name' 		   => 'Doctor',
    		'add_new' 				 => _x('Add New', 'Doctor'),
    		'add_new_item' 			=> 'Add New Doctor',
    		'edit_item'				> 'Edit Doctor',
    		'new_item' 				=> 'New Doctor',
    		'view_item' 			   => 'View Doctors',
    		'search_items' 			=> 'Search Doctors',
    		'not_found' 			   => 'No Doctors found',
    		'not_found_in_trash'	  => 'No Doctors found in Trash',
    		'parent_item_colon' 	   => '',
    		'menu_name' 			   => 'Doctors'
    	);
    
    	$args['labels'] 			= $labels;
    	$args['supports'] 			= array('title','editor','thumbnail');
    	$args['rewrite']			= array('slug' => 'Doctors');
    	$args['menu_icon']			= get_bloginfo('template_directory').'/custom/img/members.png';
    	$args['show_in_menu']		= true;
    
    	register_post_type('doctors', $args);
    }
    
    add_action('add_meta_boxes', 'add_dermaskin_meta');
    function add_dermaskin_meta()
    {
    	add_meta_box("doctors", "Add Qualification", "add_about_meta", "doctors", "normal", "default");
    }
    
    function add_about_meta($post, $metabox)
    {
    	global $post;
    
    	$qualification	= '';
    
      	$custom = get_post_custom($post->ID);
    
    	if (array_key_exists('qualification', $custom))
    	{
    		$qualification	= $custom["qualification"][0];
    	}
    
    	include(MY_THEME_FOLDER . '/custom/about.php');
    
    }
    
    // Save data
    add_action('save_post', 'save_custom', 10, 1);
    function save_custom($post_id)
    {
    	if ( isset( $_POST['post_type'] ) )
    	{
    		// About us qualifications
    		if ( $_POST['post_type'] == 'doctors' )
    		{
    			if (isset($_POST['qualification']))
    			{
    				update_post_meta($post_id, "qualification", $_POST["qualification"]);
    			}
    		}
    
    	}
    }
    ?>
    Thread Starter obidos

    (@obidos)

    Solved after searching the forums.

    It was not the way I created my custom post it was the way I was calling the information to display on the page.

    Here is what I had to do:-
    $content = apply_filters("the_content",$post->post_content);

    Hope it helps someone else.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom post types and p tags’ is closed to new replies.