Displaying Term Counts

Hello,

I have a portfolio page displaying projects from different categories (custom ACF taxonomies). I would like to display how many projects are in each category.

https://creativedesigns.mysites.io/project-portfolio/

On the first tile (Restaurants), at the bottom, I have {{dc:term:count}} Projects as the text.

I have set up a looper provider for the Div choosing the custom post type (Projects) and the taxonomy (Restaurants). It’s not working. I’m not sure why.

Is this the correct general way of doing this? Can it be done by just using the term count and adding something or does there need to be a provider for each tile?

Thanks.

Hello @zenzino,

Thanks for writing to us.

I checked your settings it seems that you have set the looper provider as a query builder to pull the posts. I have also checked that you have added terms manually. If you want to keep your settings and you want to display the project dynamically you need to add this dynamic content code. {{dc:term:count term="37"}} You need to change the term ID.


You can get the Term ID from the WordPress dashboard —>taxonaomey —>terms. Please note you don’t need to run Looper provider or Looper consumer here.

In case you want to display all the terms and their projects dynamically I have setup a section called Themeco test and set it in hidden mode. I would suggest you please unhide it and check the setting.

Hope it helps
Thanks

Hey @prakash_s,

Thanks! Adding the term ID was exactly what I was looking for.

However, your dynamic solution is awesome and exactly what I didn’t know I needed.

Thank you so much for going above and beyond with creating that example.

All of you on this forum are a big reason I will never use any other theme.

Cheers,
Don

Hey @prakash_s,

I applied the settings from your example to the project tiles.

Since those tiles have a background image, is there any way to associate a featured image to the terms so they display different background images in the different tiles?

Thanks,
Don

Hello Don,

You can use the ACF Pro plugin which is already installed on the site to create a custom featured image for each “Commercial” taxonomy. You will then use the {{dc:term:meta key="field_name"}} dynamic content to display the image.

Hope this makes sense.

Thanks @ruenel.

I’m not sure how to “attach” the featured image to an ACF taxonomy.

Hey @zenzino,

You will have to create an ACF Field with an Image type and assign it to the ACF Taxonomy. You will then edit each of the “Commercial” taxonomy and insert the taxonomy field image.

Kindly let us know how it goes.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.