Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow facet widget customization. #1160

Merged
merged 3 commits into from
Jan 7, 2019

Conversation

oscarssanchez
Copy link
Contributor

@oscarssanchez oscarssanchez commented Nov 7, 2018

Hi @allan23 ,

Could you use this PR which addresses #1068 ?

This PR uses include_once() to include the html output that was previously being displayed as part of public function widget(), and by adding a new file facet-frontend-template.php to the includes folder.

This enables users to replace the default template with one of their choice as noted in #1068 by adding a new filter to replace the template path

Thanks!

@oscarssanchez
Copy link
Contributor Author

Hi @allan23 ,

I removed the facet template and stored the html in a variable as we discussed. Let me know if I catched this right.

Thank you!

@@ -229,6 +231,8 @@ public function widget( $args, $instance ) {
</div>
</div>
<?php
$facet_html = ob_get_clean();
echo apply_filters( 'ep_facet_search_widget', $facet_html );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's pass along some data (selected filters, current facets, etc.).

Ideally, we want a developer to either be able to modify the existing HTML or replace it completely with their own.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I passed $selected_filters, $terms_by_slug, $outputted_terms to the filter, so they can build upon those :)

@@ -0,0 +1,124 @@
<?php
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file still needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file was deleted. Thanks :)

@oscarssanchez
Copy link
Contributor Author

oscarssanchez commented Nov 21, 2018

Hi @allan23 ,

Thanks! I addressed this in a new commit.

I'm passing $selected_filters, $terms_by_slug, $outputted_terms as I see those are the main ones that are used to build the widget html.

@allan23 allan23 merged commit b2f77c7 into 10up:develop Jan 7, 2019
allan23 pushed a commit that referenced this pull request Jan 21, 2019
allan23 pushed a commit that referenced this pull request Jan 21, 2019
* Revert "Remove weighting by date (#940)"

This reverts commit f8efd8d.

* Revert "Allow facet query string customization. (#1198) (#1208)"

This reverts commit c30a95e.

* Revert "Correct a comment. (#1172)"

This reverts commit 5336413.

* Revert "Hide prefix trailing dash on settings page (#1204)"

This reverts commit 2adc740.

* Revert "WIP Sticky posts feature. (#1164)"

This reverts commit 917d02b.

* Revert "ep_indexable_blogs filter (#1209)"

This reverts commit 4cba515.

* Revert "Fix postType being set to 'publish' instead of postStatus. (#1173)"

This reverts commit a253dc3.

* Revert "Allow facet widget customization. (#1160)"

This reverts commit b2f77c7.

* Revert "Filter prefiltered post_types when protected content feature enabled. (#1135)"

This reverts commit 8b86bb4.

* Revert "Use wildcard query with compare like. (#1167)"

This reverts commit bde2c18.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants