Skip Navigation

[Resolved] Display Select options and their post count

This support ticket is created 6 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Tagged: 

This topic contains 1 reply, has 2 voices.

Last updated by Laura 6 years, 1 month ago.

Assisted by: Laura.

Author
Posts
#1118912

I have the following custom field for a "Ticket" post type:

Name: Status
Slug: ticket-status
Type: Select
Options:
- New
- Progress
- Waiting
- On Hold
- Closed

I would like to be able to display all options and their post count so it will look like this

New (5)
Progress (9)
Waiting (3)
On Hold (1)
Closed (25)

How do I achieve this?

#1119089

Laura
Supporter

Languages: English (English )

Hi,

to display your CPT, you should create a Content Template for it.
In our Documentation we have several pages and guides on how to do it. Read it here:
https://toolset.com/documentation/getting-started-with-toolset/create-templates-to-display-custom-posts/designing-a-template-without-any-page-builder/
https://toolset.com/documentation/user-guides/view-templates/

About displaying the count number for each custom field, you need to create a View for this. In Views, you can add a filter for custom fields and you’ll get the chance to add a count option. You should get a shortcode similar to this one:

[wpv-control-postmeta field="wpcf-yourfieldslug" format="%%NAME%% (%%COUNT%%)" url_param="wpv-wpcf-yourfieldslug"]

See our Views Shortcode reference: https://toolset.com/documentation/user-guides/views-shortcodes/#vf-520693

Then you can add this View to your Content Template
More information here: https://toolset.com/documentation/getting-started-with-toolset/filter-content-lists-and-add-custom-search/

Let me know if this helps you or if you need further assistance.