Advertisement
qlstudio

CPT Examples

May 28th, 2013
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.14 KB | None | 0 0
  1. /* register "filter" taxonomy for "vendor* CPT */
  2. add_action( 'init', 'es_taxonomy_vendor_filter' );
  3. function es_taxonomy_vendor_filter() {
  4.    register_taxonomy(
  5.       'filter',
  6.       'vendor',
  7.       array(
  8.          'label' => __( 'Filter' ),
  9.          'rewrite' => array( 'slug' => 'filter' ),
  10.          //'hierarchical'  => true, // page style ##
  11.       )
  12.    );
  13. }
  14.  
  15.  
  16.  
  17. /* register "location" taxonomy for "vendor* CPT */
  18. add_action( 'init', 'es_taxonomy_vendor_location' );
  19. function es_taxonomy_vendor_location() {
  20.    register_taxonomy(
  21.       'location',
  22.       'vendor',
  23.       array(
  24.          'label' => __( 'Location' ),
  25.          'rewrite' => array( 'slug' => 'location' )
  26.       )
  27.    );
  28. }
  29.  
  30.  
  31.  
  32. // register "vendor" custom post type ##
  33. add_action( 'init', 'es_cpt_vendor' );
  34. function es_cpt_vendor() {
  35.     $args = array(
  36.         'public'        => true,
  37.         'label'         => 'Vendors',
  38.         'hierarchical'  => true, // page style ##
  39.         'supports'      => array(
  40.             'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments', 'page-attributes'
  41.         )
  42.     );
  43.     register_post_type( 'vendor', $args );
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement