Return to Snippet

Revision: 35786
at November 13, 2010 05:42 by jli


Updated Code
//CUSTOM POST TYPES DEFINITIONS
	add_action('init', 'cpt_activites_register', 1);

	function cpt_activites_register() {
    	$args = array(
        	'label' => __('Activités'),
        	'singular_label' => __('Activité'),
    		'_builtin' => false,
        	'public' => true,
        	'show_ui' => true,
        	'capability_type' => 'post',
        	'hierarchical' => false,
    		//'publicly_queryable' => false,
    		//'exclude_from_search' => true,    	
        	'rewrite' => array("slug" => "activite"),
        	'supports' => array('title', 'editor', 'thumbnail')
        );

    	register_post_type( 'activite' , $args );
	}
	
	add_action('init', 'cpt_restaurants_register', 1);

	function cpt_restaurants_register() {
    	$args = array(
        	'label' => __('Restaurants'),
        	'singular_label' => __('Restaurant'),
    		'_builtin' => false,
        	'public' => true,
        	'show_ui' => true,
        	'capability_type' => 'post',
        	'hierarchical' => false,
    		'publicly_queryable' => false,
    		'exclude_from_search' => true,    	
        	'rewrite' => array("slug" => "restaurant"),
        	'supports' => array('title', 'editor', 'thumbnail')
        );

    	register_post_type( 'restaurant' , $args );
	}

Revision: 35785
at November 13, 2010 05:38 by jli


Initial Code
//CUSTOM POST TYPES DEFINITIONS
	add_action('init', 'cpt_activites_register', 1);

	function cpt_activites_register() {
    	$args = array(
        	'label' => __('Activités'),
        	'singular_label' => __('Activité'),
    		'_builtin' => false,
        	'public' => true,
        	'show_ui' => true,
        	'capability_type' => 'post',
        	'hierarchical' => false,
    		//'publicly_queryable' => false,
    		//'exclude_from_search' => true,    	
        	'rewrite' => array("slug" => "activite"),
        	'supports' => array('title', 'editor', 'thumbnail')
        );

    	register_post_type( 'activite' , $args );
	}
	
	add_action('init', 'cpt_restaurants_register', 1);

	function cpt_restaurants_register() {
    	$args = array(
        	'label' => __('Restaurants'),
        	'singular_label' => __('Restaurant'),
    		'_builtin' => false,
        	'public' => true,
        	'show_ui' => true,
        	'capability_type' => 'post',
        	'hierarchical' => false,
    		'publicly_queryable' => false,
    		'exclude_from_search' => true,    	
        	'rewrite' => array("slug" => "restaurant"),
        	'supports' => array('title', 'editor', 'thumbnail')
        );

    	register_post_type( 'restaurant' , $args );
	}

Initial URL


Initial Description


Initial Title
Wordpress CPT examples

Initial Tags
post, wordpress

Initial Language
PHP