Learn how to add a WordPress category image and efficiently display categories with nested listings using JetEngine, JetThemeCore, and Elementor. Create elaborate post designs and express your creativity.
Setting Up Categories
Before we start, let’s understand our workspace. In WordPress, categories are like the folders on your computer. You’ve got:
- Parent Categories:
- Books
- Photography
- Travel
- Child Categories (for Photography as an example):
- Landscape
- Macro
- Portrait
Now, imagine if each of these folders had a cool icon. That’s what we’re aiming for!
Adding a WordPress Category Image
- Click on ‘Taxonomies’ via the JetEngine Menu. If it looks empty, don’t fret. There’s a ‘Built-In’ button. Click on it, and ‘Categories’ will appear.
- In ‘Taxonomies’, you’ll see ‘Categories’. Click on it.
- Here, we’ll add a new meta field. This is where our image will reside.
- For the ‘Field Type’, select ‘Media’.
- Hit ‘Update’ to save your changes.
Now, return to your categories. You’ll spot a new image field. Time to upload an image for each category!
Displaying Category Images on Posts
- Go to JetEngine > Query Builder
- Create a New Query
Name it ‘Parent Category Query’. - Post Terms Query
Select this and opt for ‘Categories’ for taxonomy. - Object Post IDs
Pick ‘Current ID’. - Parent Category Display
To showcase only parent categories, set the ‘Parent Child’ option to ‘Parent’ and set the value to ‘0’.
Building a Listing Item with JetEngine
- Go to ‘Listings’ on the JetEngine menu.
- Click on ‘Add New’ to create a new listing.
- For ‘Listing source’, choose ‘Taxonomies’.
- For ‘From Taxonomy’, select ‘Categories’.
- Click on ‘Create Listing Item’ and it will launch the Elementor editor.
- Here, you’ll use JetEngine widgets to design your listing.
- Drag the ‘Dynamic Field’ widget onto the canvas. Set the ‘Object Field’ to ‘Name’ to display the category name.
- Next, drag the ‘Dynamic Image’ widget. Set the ‘Source’ to ‘Term Thumbnail’ to display the WordPress category image you added.
- Feel free to adjust the layout, style, and other design elements to your liking.
- Once you’re satisfied with the design, click ‘Publish’ or ‘Update’ to save your listing item.
Building a Custom Single Post Template with Nested Listings
- Navigate to the Crocoblock theme builder.
- Start crafting your post template.
- Add dynamic fields for the post title and content.
- Display your categories using the JetEngine listing grid you just created.
Displaying Nested Listings
Nested listings are like the sub-folders within your main folders.
Create New Child Category Query
- In JetEngine’s Query Builder, create a ‘Child Category Query’.
- Select ‘Terms Query’ as the query type.
- In the General tab select ‘Categories’ as taxonomy.
- Select ‘Current ID’, click on Advanced Settings, and select ‘Default WordPress Object (for current page)’ as the Object/Post Ids.
- Go to the ‘Parent/Child’ tab and select ‘Queried term’ under Parent.
- Save the new query.
Create New JetEngine Child Category Listing
- Go to ‘Listings’ on the JetEngine menu.
- Click on ‘Add New’ to create a new listing.
- For ‘Listing source’, choose ‘Terms’.
- For ‘From Taxonomy’, select ‘Categories’.
- Click on ‘Create Listing Item’ and it will launch the Elementor editor.
- Add a dynamic image widget and under ‘Custom meta field/repeater key’ enter ‘image’.
- Update the listing.
Add child listing to parent listing
- Open your parent category listing which you created earlier.
- Add a listing grid within it.
- Select the child category listing.
- Under ‘Custom Query’ select your ‘Child Category Query’.
- Refine the listing designs to your liking.
Wrapping Up
With JetEngine, there are so many possibilities to customize your WordPress site. Whether you’re adding WordPress category images or setting up nested listings, the possibilities are endless. Have fun experimenting.