qlstudio

CPT Examples

May 28th, 2013
41
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×