BACK TO DIRECTORY

Primary Categories

by Jacob McKinney

4.5
(2 ratings)

WordPress plugin for setting and displaying primary categories for posts and custom post types*.

This plugin creates a meta box on the post edit screen titled “Primary Category” containing a drop down menu populated with all categories associated with that post**. Selecting a primary category and updating the post saves this data into a custom field with a meta key of “primary-category”.

To display a list of all posts with a particular primary category, use the shortcode [primary-category name=”cat_name”] where cat_name is the name of the primary category you wish to display. If a name is not specified, the shortcode will default to all posts with “uncategorized” set as the primary category.

*Note: Custom post types must support both categories and custom fields.

**Note: As new categories are added to a post, the post must be updated before those new categories will be available for selection as a primary category.

Screenshots

Example of post edit screen with primary category meta box.

Example of post edit screen with primary category meta box.

Example of shortcode being used in page.

Example of shortcode being used in page.

Example output of shortcode.

Example output of shortcode.

Plugin Details

Active Installs
20
Total Downloads
5,727
Version
1.0.0
Requires WP
3.4
Requires PHP
Tested Up To
4.9.31
Added
2016-05-17
Last Updated
2018-08-05 4:48pm GMT

Ratings

5
1
4
1
3
0
2
0
1
0