[ create a new paste ] login | about

Link: http://codepad.org/ceQH4a6a    [ raw code | fork ]

jonedwards - PHP, pasted on Nov 29:
<?php

// register entrepreneurs custom post-type

add_action( 'init', 'register_cpt_entrepreneurs' );

function register_cpt_entrepreneurs() {

    $labels = array( 
        'name' => _x( 'Entrepreneurs', 'entrepreneurs' ),
        'singular_name' => _x( 'Entrepreneur', 'entrepreneurs' ),
        'add_new' => _x( 'Add New', 'entrepreneurs' ),
        'add_new_item' => _x( 'Add New Entrepreneur', 'entrepreneurs' ),
        'edit_item' => _x( 'Edit Entrepreneur', 'entrepreneurs' ),
        'new_item' => _x( 'New Entrepreneur', 'entrepreneurs' ),
        'view_item' => _x( 'View Entrepreneur', 'entrepreneurs' ),
        'search_items' => _x( 'Search Entrepreneurs', 'entrepreneurs' ),
        'not_found' => _x( 'No entrepreneurs found', 'entrepreneurs' ),
        'not_found_in_trash' => _x( 'No entrepreneurs found in Trash', 'entrepreneurs' ),
        'parent_item_colon' => _x( 'Parent Entrepreneur:', 'entrepreneurs' ),
        'menu_name' => _x( 'Entrepreneurs', 'entrepreneurs' ),
    );

    $args = array( 
        'labels' => $labels,
        'hierarchical' => true,
        
        'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'custom-fields', 'revisions' ),
        'taxonomies' => array( 'sectors', 'post_tag' ),
        'public' => true,
        'show_ui' => true,
        'show_in_menu' => true,
        'menu_position' => 20,
        
        'show_in_nav_menus' => true,
        'publicly_queryable' => true,
        'exclude_from_search' => false,
        'has_archive' => true,
        'query_var' => true,
        'can_export' => true,
        'rewrite' => array( 
            'slug' => 'entrepreneurship/our-entrepreneurs', 
            'with_front' => false,
            'feeds' => true,
            'pages' => true
        ),
        'capability_type' => 'post'
    );

    register_post_type( 'entrepreneurs', $args );
}

// register sectors taxonomy

add_action( 'init', 'register_taxonomy_sectors' );

function register_taxonomy_sectors() {

    $labels = array( 
        'name' => _x( 'Sectors', 'sector' ),
        'singular_name' => _x( 'Sector', 'sector' ),
        'search_items' => _x( 'Search Sectors', 'sector' ),
        'popular_items' => _x( 'Popular Sectors', 'sector' ),
        'all_items' => _x( 'All Sectors', 'sector' ),
        'parent_item' => _x( 'Parent Sector', 'sector' ),
        'parent_item_colon' => _x( 'Parent Sector:', 'sector' ),
        'edit_item' => _x( 'Edit Sector', 'sector' ),
        'update_item' => _x( 'Update Sector', 'sector' ),
        'add_new_item' => _x( 'Add New Sector', 'sector' ),
        'new_item_name' => _x( 'New Sector Name', 'sector' ),
        'separate_items_with_commas' => _x( 'Separate sectors with commas', 'sector' ),
        'add_or_remove_items' => _x( 'Add or remove sectors', 'sector' ),
        'choose_from_most_used' => _x( 'Choose from the most used sectors', 'sector' ),
        'menu_name' => _x( 'Sectors', 'sector' ),
    );

    $args = array( 
        'labels' => $labels,
        'public' => true,
        'show_in_nav_menus' => true,
        'show_ui' => true,
        'show_tagcloud' => false,
        'hierarchical' => true,

        'rewrite' => array( 
            'slug' => 'our-entrepreneurs-by-sector', 
            'with_front' => false,
            'hierarchical' => true
        ),
        'query_var' => true
    );

    register_taxonomy( 'sectors', array('entrepreneurs'), $args );
}


?>


Create a new paste based on this one


Comments: