Support

Account

Home Forums General Issues Post Object field: "no matches found" Reply To: Post Object field: "no matches found"

  • thanks john (i should just keep you on retainer here).

    i’m using the following code in the theme’s functions.php file:

    // Add Multiple Custom Post Types
    
    add_action('init', 'all_custom_post_types');
    
    function all_custom_post_types() {
      $types = array(
        // News
        array('the_type' => 'news',
              'single' => 'News',
              'plural' => 'News'),
        // Artists
        array('the_type' => 'artist',
              'single' => 'Artist',
              'plural' => 'Artists'),
        // Releases
        array('the_type' => 'release',
              'single' => 'Release',
              'plural' => 'Releases')
      );
    
    foreach ($types as $type) {
      $the_type = $type['the_type'];
        $single = $type['single'];
        $plural = $type['plural'];
      $labels = array(
          'name' => _x($plural, 'post type general name'),
          'singular_name' => _x($single, 'post type singular name'),
          'add_new' => _x('Add New', $single),
          'add_new_item' => __('Add New '. $single),
          'edit_item' => __('Edit '.$single),
          'new_item' => __('New '.$single),
          'view_item' => __('View '.$single),
          'search_items' => __('Search '.$plural),
          'not_found' =>  __('No '.$plural.' found'),
          'not_found_in_trash' => __('No '.$plural.' found in Trash'),
          'parent_item_colon' => ''
        );
        $args = array(
          'labels' => $labels,
          'public' => true,
          'publicly_queryable' => true,
          'show_ui' => true,
          'query_var' => true,
          'rewrite' => true,
          'capability_type' => 'post',
          'hierarchical' => false,
          'has_archive' => true,
          'menu_position' => 5,
          'supports' => array('title','editor','thumbnail'),
          'show_in_menu' => true,
          'show_in_nav_menus' => true,
          'taxonomies' => array( 'category' )
        );
    
        register_post_type($the_type, $args);
      }
    }

    is this what you mean?