Advertisement
pushtook

pojo cpt

Jul 28th, 2016
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.28 KB | None | 0 0
  1. <?php
  2. // add CPT to pojo posts archive
  3.  
  4. function pojo_taxonomies_job_offers() {
  5.  
  6. function pojo_add_post_type_to_smart_page_job_offers( $post_types = array() ) {
  7.     $post_types[] = 'job_offers';
  8.     return $post_types;
  9. }
  10. add_filter( 'pf_format_content_list', 'pojo_add_post_type_to_smart_page_job_offers' );
  11.  
  12.  
  13. function pojo_smart_page_add_fields_job_offers( $fields = array() ) {
  14.     $cpt = 'job_offers';
  15.  
  16.     $fields[] = array(
  17.         'id' => 'content',
  18.         'type' => Pojo_MetaBox::FIELD_HIDDEN,
  19.         'std' => $cpt,
  20.     );
  21.    
  22.     // If you want filter by Taxonomy
  23.     $fields[] = array(
  24.      'id' => 'taxonomy',
  25.      'type' => Pojo_MetaBox::FIELD_HIDDEN,
  26.      'std' => 'field-of-work',
  27.     );
  28.    
  29.     $fields[] = array(
  30.      'id' => 'taxonomy_terms',
  31.      'title' => __( 'Choose Category', 'pojo' ),
  32.      'type' => Pojo_MetaBox::FIELD_TAXONOMY_TERM_CHECKBOX,
  33.      'taxonomy' => 'field-of-work',
  34.     );
  35.    
  36.     $fields[] = array(
  37.         'id' => 'display_type',
  38.         'title' => __( 'Select Content Layout', 'pojo' ),
  39.         'type' => Pojo_MetaBox::FIELD_SELECT,
  40.         'options' => array(
  41.             '' => __( 'Default', 'pojo' ),
  42.             'gallery_grid_3' => __( 'Grid 3', 'pojo' ),
  43.             'list' => __( 'list', 'pojo' ),
  44.         ),
  45.         'std' => '',
  46.     );
  47.  
  48.     //extra fields
  49.  
  50.     /*$fields[] = array(
  51.             'id'      => 'gallery_advanced_settings',
  52.             'title'   => __( 'Advanced Settings', 'pojo' ),
  53.             'type'    => Pojo_MetaBox::FIELD_BUTTON_COLLAPSE,
  54.         );*/
  55.  
  56.         $fields[] = array(
  57.             'id'      => 'posts_per_page_mode',
  58.             'title'   => __( 'Galleries Per Page', 'pojo' ),
  59.             'type'    => Pojo_MetaBox::FIELD_SELECT,
  60.             'classes' => array( 'select-show-or-hide-fields' ),
  61.             'options' => array(
  62.                 '' => __( 'Default', 'pojo' ),
  63.                 'custom' => __( 'Custom', 'pojo' ),
  64.             ),
  65.             'std'     => '',
  66.         );
  67.  
  68.         $fields[] = array(
  69.             'id'      => 'posts_per_page',
  70.             'title'   => __( 'Number Galleries', 'pojo' ),
  71.             'std'     => get_option( 'posts_per_page' ),
  72.             'show_on' => array( 'po_posts_per_page_mode' => 'custom' ),
  73.         );
  74.  
  75.         $fields[] = array(
  76.             'id' => 'order_by',
  77.             'title' => __( 'Order By', 'pojo' ),
  78.             'type' => Pojo_MetaBox::FIELD_SELECT,
  79.             'options' => array(
  80.                 '' => __( 'Date', 'pojo' ),
  81.                 'menu_order' => __( 'Menu Order', 'pojo' ),
  82.                 'title' => __( 'Title', 'pojo' ),
  83.                 'rand' => __( 'Random', 'pojo' ),
  84.             ),
  85.             'std' => '',
  86.         );
  87.  
  88.         $fields[] = array(
  89.             'id' => 'order',
  90.             'title' => __( 'Order', 'pojo' ),
  91.             'type' => Pojo_MetaBox::FIELD_SELECT,
  92.             'options' => array(
  93.                 '' => __( 'DESC', 'pojo' ),
  94.                 'ASC' => __( 'ASC', 'pojo' ),
  95.             ),
  96.             'std' => '',
  97.         );
  98.  
  99.         $fields[] = array(
  100.             'id'      => 'offset',
  101.             'title'   => __( 'Offset', 'pojo' ),
  102.             'std'     => 0,
  103.             'desc'    => __( 'Number of post to displace or pass over', 'pojo' ),
  104.         );
  105.  
  106.         $fields[] = array(
  107.             'id'      => 'pagination',
  108.             'title'   => __( 'Pagination', 'pojo' ),
  109.             'type'    => Pojo_MetaBox::FIELD_SELECT,
  110.             'options' => po_get_theme_pagination_support(),
  111.             'std'     => '',
  112.         );
  113.  
  114.         $fields[] = array(
  115.             'id'      => 'gallery_advanced_settings',
  116.             'title'   => __( 'Advanced Settings', 'pojo' ),
  117.             'type'    => Pojo_MetaBox::FIELD_BUTTON_COLLAPSE,
  118.             'mode'    => 'end',
  119.         );
  120.    
  121.     return $fields;
  122. }
  123. add_filter( 'pf_list_posts_cpt-job_offers', 'pojo_smart_page_add_fields_job_offers' );
  124. }
  125. add_action( 'init', 'pojo_taxonomies_job_offers', 0 );
  126. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement