Forum Replies Created

Viewing 2 replies - 16 through 17 (of 17 total)
  • jchiappisi

    (@jchiappisi)

    1. You can change this page’s presentation through the Category Template, which can be named category.php. You can also create category-services.php, assuming that your category slug is ‘services’. This would use this category template for that specific category.

    2. You can specify number of posts returned within the query, limiting it to 10 if you wish.

    Thread Starter jchiappisi

    (@jchiappisi)

    This is the code used to initiate the custom post type ‘Events‘:

    add_action('init', 'createEvents');
    
    function createEvents(){
    
    // Fire this during init
    register_post_type('events', array(
    	'label' => __('Events'),
    	'singular_label' => __('Event'),
    	'add_new_item' => __('Add New Event'),
    	'edit_item' => __('Edit Event'),
    	'new_item' => __('New Event'),
    	'view_item' => __('View Event'),
    	'public' => true,
    	'show_ui' => true,
    	'capability_type' => 'post',
    	'hierarchical' => false,
    	'show_in_menu' => true,
    	'menu_position' => 20,
    	'rewrite' => false,
    	'show_in_nav_menus' => false,
    	'supports' => array('title', 'editor', 'author', 'excerpt','eventcategories')
    ));
    }

    This is the code used to initiate the custom taxonomy ‘Event Categories‘:

    add_action('init','create_event_taxonomies');
    
    function create_event_taxonomies(){
    	register_taxonomy('eventcategories','events',
    		array(
    			'hierarchical' => true,
    			'label' => 'Event Categories',
    			'singular_label' => 'Event Category',
    			'show_ui' => true,
        		'query_var' => 'events',
        		'rewrite' => array( 'slug' => 'event-type' ),
    	));
    }
Viewing 2 replies - 16 through 17 (of 17 total)