• Resolved wipdowntown

    (@wipdowntown)


    Hello–

    To add/modify a post type. What is the easiest way to do that? Our example is we have two categories of listings. Those under $500,000 and those over $500,000. So, we would like to have the choice of “Property” as it is now. Then “Exclusive Property” for the over $500,000. Do I need to go into functions.php file…or, is there another way to do this? Thanks for your great support…love the plugin.

    https://wordpress.org/plugins/easy-property-listings/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Merv Barrett

    (@mervb1)

    Personally I would keep them all under the single property post type as they are all the same except for the price and filter your output to only display over/under the 500,000

    You could also use an exclusive tag to sort of make the over 500k ones really great.

    It is possible to add the exclusive as a separate property post type and will require some coding to accomplish that. The CPT API built into EPL makes this task much easier for you.

    Will look at adding a codex doc for this challenge for you.

    We just released 3.0 so are monitoring for issues before we can get to the doc. You can also look at Priority Support or Advanced Development as we will be tackling them first and helps a lot.

    Plugin Author Merv Barrett

    (@mervb1)

    Been a bit busy with 3.0 so here is some quick code before we put together a full tutorial.

    /**
     * Check if Easy Property Listings is running with EPL_CPT Class
     *
     */
    if ( class_exists ( 'EPL_CPT' ) ) { 
    
    	/**
    	 * Register Custom Post Type with WordPress
    	 *
    	 * @see EPL_CPT http://docs.easypropertylistings.com.au/class-EPL_CPT.html
    	 * @see register_post_type https://codex.wordpress.org/Function_Reference/register_post_type
    	 */
    	$my_epl_post_type_name = new EPL_CPT(
    		array(
    			'post_type_name' 	=> 'my_post_type_name',
    			'singular' 		=> __('Post Type Name Singular','textdomain'),
    			'plural' 		=> __('Post Type Name Plural','textdomain'),
    			'slug' 			=> 'my-post-slug'
    		),
    		array(
    			'capability_type'	=>	'post',
    			'hierarchical'		=>	true,
    			'exclude_from_search' 	=>	false,
    			'menu_position'		=>	'30',
    			'supports'		=>	array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments', 'revisions', 'page-attributes' )
    		)
    	);
    
    	/**
    	 * Register Custom Post Type with EPL Core
    	 *
    	 * @since 1.0
    	 */
    	function my_register_post_type_with_epl($posts) {
    		$posts[] = 'my_post_type_name';
    		return $posts;
    	}
    	add_filter('epl_additional_post_types','my_register_post_type_with_epl');
    
    	/**
    	 * Add EPL Location Taxonomy to Custom Post Type
    	 *
    	 * @since 1.0
    	 */
    	$my_epl_post_type_name->register_taxonomy('location');
    
    	/**
    	 * Assign Dash Icon to Custom Post Type
    	 *
    	 * @see dashicons https://developer.wordpress.org/resource/dashicons/
    	 */
    	$my_epl_post_type_name->menu_icon("dashicons-admin-network");
    
    }
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Add or Modify a Post Type’ is closed to new replies.