Archived topic
Generatepress and facetwp
1 reply · Started by Marco on March 20, 2019
Hello
I'm experiencing some issues with generatepress and facetwp - first of all facetwp requires a wrapping container with the class facetwp-template for the articles otherwise it kind of adds the class to the uppermost container and produces an error message - I guess we basically need a structure like:
<main>...
<div class="page-header">...
<div class="facets">
<div class="articles facetwp-template">.... wrapper for articles
<article>...
<article>...
another issue I'm experiencing is that on the homepage facetwp doesn't seem to recognize the main query so the dropdown for categories and tags are empty - maybe this is how to solve this: https://facetwp.com/documentation/developers/querying/facetwp_is_main_query/
hope somebody can shed some light - thanks
Hi there,
To add a wrapper around the posts, you can create two Hook Elements: https://docs.generatepress.com/article/hooks-element-overview/
The first would be your opening element, and would be added to the generate_before_main_content hook:
<div class="facets">
The second would be your closest element, which would be added to the generate_after_main_content hook:
</div>
Then you can use the Display Rules to choose where this element should be added.
I'm not sure about the query thing, as GP just uses the standard WP query. Have you checked with FacetWP on this?