Home Forums Basel support forum Revolution Slider cant load portfolio/ projects custom post type might be a bug Reply To: Revolution Slider cant load portfolio/ projects custom post type might be a bug

#19863

Artem Temos
Keymaster

We use an absolutely similar code in our theme. Here it is

	
add_action( 'init', array($this, 'register_portfolio'), 1 );

public function register_portfolio() {

		$labels = array(
			'name'                => _x( 'Portfolio', 'Post Type General Name', $this->domain ),
			'singular_name'       => _x( 'Project', 'Post Type Singular Name', $this->domain ),
			'menu_name'           => __( 'Projects', $this->domain ),
			'parent_item_colon'   => __( 'Parent Item:', $this->domain ),
			'all_items'           => __( 'All Items', $this->domain ),
			'view_item'           => __( 'View Item', $this->domain ),
			'add_new_item'        => __( 'Add New Item', $this->domain ),
			'add_new'             => __( 'Add New', $this->domain ),
			'edit_item'           => __( 'Edit Item', $this->domain ),
			'update_item'         => __( 'Update Item', $this->domain ),
			'search_items'        => __( 'Search Item', $this->domain ),
			'not_found'           => __( 'Not found', $this->domain ),
			'not_found_in_trash'  => __( 'Not found in Trash', $this->domain ),
		);

		$args = array(
			'label'               => __( 'portfolio', $this->domain ),
			'labels'              => $labels,
			'supports'            => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments' ),
			'hierarchical'        => false,
			'public'              => true,
			'show_ui'             => true,
			'show_in_menu'        => true,
			'show_in_nav_menus'   => true,
			'show_in_admin_bar'   => true,
			'menu_position'       => 28,
			'menu_icon'           => 'dashicons-images-alt2',
			'can_export'          => true,
			'has_archive'         => true,
			'exclude_from_search' => true,
			'publicly_queryable'  => true,
			'rewrite'             => array('slug' => 'portfolio'),
			'capability_type'     => 'page',
		);

		register_post_type( 'portfolio', $args );

		/**
		 * Create a taxonomy category for portfolio
		 *
		 * @uses  Inserts new taxonomy object into the list
		 * @uses  Adds query vars
		 *
		 * @param string  Name of taxonomy object
		 * @param array|string  Name of the object type for the taxonomy object.
		 * @param array|string  Taxonomy arguments
		 * @return null|WP_Error WP_Error if errors, otherwise null.
		 */
		
		$labels = array(
			'name'					=> _x( 'Project Categories', 'Taxonomy plural name', $this->domain ),
			'singular_name'			=> _x( 'Project Category', 'Taxonomy singular name', $this->domain ),
			'search_items'			=> __( 'Search Categories', $this->domain ),
			'popular_items'			=> __( 'Popular Project Categories', $this->domain ),
			'all_items'				=> __( 'All Project Categories', $this->domain ),
			'parent_item'			=> __( 'Parent Category', $this->domain ),
			'parent_item_colon'		=> __( 'Parent Category', $this->domain ),
			'edit_item'				=> __( 'Edit Category', $this->domain ),
			'update_item'			=> __( 'Update Category', $this->domain ),
			'add_new_item'			=> __( 'Add New Category', $this->domain ),
			'new_item_name'			=> __( 'New Category', $this->domain ),
			'add_or_remove_items'	=> __( 'Add or remove Categories', $this->domain ),
			'choose_from_most_used'	=> __( 'Choose from most used text-domain', $this->domain ),
			'menu_name'				=> __( 'Category', $this->domain ),
		);
	
		$args = array(
			'labels'            => $labels,
			'public'            => true,
			'show_in_nav_menus' => true,
			'show_admin_column' => false,
			'hierarchical'      => true,
			'show_tagcloud'     => true,
			'show_ui'           => true,
			'query_var'         => true,
			'rewrite'           => true,
			'query_var'         => true,
			'capabilities'      => array(),
		);
	
		register_taxonomy( 'project-cat', array( 'portfolio' ), $args );

	}

Regards