- JetThemeCore plugin installed and activated
- Gutenberg Block Editor or Elementor Page Builder
- Listing template built with the JetEngine plugin
- AJAX Search by JetSearch or Search by JetBlocks
- Blocks/widgets to display posts. For instance, Posts (from the JetElements plugin), Smart Posts List (available in the JetBlog plugin), Listing Grid (from the JetEngine plugin).
Creating an Archive Template
Open the WordPress Dashboard > Crocoblock > Theme Templates screen to look at the theme part templates.
Click the “Add New” button at the top to create an archive template. In the appeared pop-up, fill in the fields with the required information.
Set the “Archive” option as the Template Type. The following Template Content Type drop-down list is to determine whether you want to create a template by using the “Block Editor” or “Elementor.”
Also, you can complete the Template Name. Though this field is optional, the template will automatically receive the name if you leave this field empty.
Hit the “Create Template” button to proceed to the editor.
Once the editor is opened, we add the Listing Grid block. Initially, select a Listing and then adjust the following settings.
Ensure you have enabled the Use as Archive Template option to make the block inherit the archive settings.
In case you want to display the publications you have in Elementor, use one of the widgets below:
- Posts (from the JetElements plugin);
- Smart Posts List (available in the JetBlog plugin);
- Listing Grid (from the JetEngine plugin).
Depending on the widget you choose, your posts will be displayed with different layouts. Drag-and-drop it on the page, and don’t forget to style it according to your taste and needs.
Make sure to enable the Is Archive Template option for the proper work of the search.
Once the page is ready, click the “Update” button and return to the WordPress Dashboard > Crocoblock > Theme Templates.
As you can see in the Instances tab next to the newly built template, the conditions are not set yet. So, press the “Edit Conditions” button to make a change.
Press the “Add Condition” button to establish the new condition.
Beginning with the first selector, pick “Include” as we want to enable the template. The next option to be chosen in the second drop-down menu is “Archive,” and the third one should be defined as “Search Results.”
That’s it for changes, so we push the “Save Conditions” button.
Now you can notice that the condition is displayed in the Instances tab.
That’s enough to create an archive template if you want to display the custom archive when the search results are shown. Now go to the website page where the search is located and type in a keyword in the search field to see how everything works.
Everything works fine; now, you can easily create an archive template for the search results in Block Editor and Elementor using the JetThemeCore plugin.