robbertdk / wordpress-ajax-filter-posts Goto Github PK
View Code? Open in Web Editor NEWA WordPress plugin to filter posts with taxonomies terms and load more posts via Ajax
License: GNU General Public License v2.0
A WordPress plugin to filter posts with taxonomies terms and load more posts via Ajax
License: GNU General Public License v2.0
Hi,
Thank you for this really nice plugin. I was wondering myself if there was a way to add a "Clear" button which would reset all applied filters ?
Thanks a lot,
David
This creates the capability of a developer set extra arguments on the initial query and the queries with the activated filters.
For example to add specific ordering, pagination or other tax query arguments.
UPDATE
This issue was due to Polylang plugin, after deactivate it, everything worked correctly. I tried Loco Translate and everything seems ok now.
Hi,
I just found your awesome plugin and tried it but there is a JSON parse error when trying to load more or filter my posts.
Here the console log error :
Uncaught SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at XMLHttpRequest.request.onload (ajax-filter-posts.js?ver=4.9.6:200)
I changed the line 188 in ajax-filter-posts.js :
request.setRequestHeader("Content-Type", "text/plain");
It seems to be working, but I'm not sure if it's ok and secondly, a load more or filter request now return a 400 Bad Request error:
POST http://skald/wp-admin/admin-ajax.php 400 (Bad Request)
getAJAXPosts @ ajax-filter-posts.js?ver=4.9.6:230
handleFilterEvent @ ajax-filter-posts.js?ver=4.9.6:84
(anonymous) @ ajax-filter-posts.js?ver=4.9.6:24
(anonymous) @ ajax-filter-posts.js?ver=4.9.6:264
ajax-filter-posts.js?ver=4.9.6:193
0
I don't know if you're still updating this plugin, but is there a way to help me with that ?
Thanks.
Hello,
I’m using Oxygen Builder who removes WP template system so I'd like to overwrite templates with a custom plugin (like that https://wpdevdesign.com/how-to-override-woocommerce-templates-using-a-custom-functionality-plugin/ ).
I don't think there is a hook to do that in your plugin, but some plugins give us the possibility to do that like woocommerce :
Is it possible to implement a hook like that ?
Thanks
Hi, is it possible to add the post_status in query args ?
Thanks for your answer !
could you show an example of adding to the filter meta key value?
e.g. input price and posts are filtered with an exact match value price
Just like the workings of radio buttons
This plugin includes a lot of specific styling. Although it's easy to remove the styling, I like a more bare bones approach. The idea of this plugin is that it would be easy for theme authors to add an ajax filter and pagination functionality to the theme without the hassle of setting up the AJAX fetching and the filtering, not providing a fully designed filter plugin.
From that point of view the styling is redundant and anoying.
First off, thank you for creating this plugin- it looks to do exactly what I need for a current project. I'm experiencing an issue with the posts not loading, however, when clicking on filters. On my template page, using the shortcode, I can see the filters and posts rendered on the page, but when I click on one of the terms to filter posts, it just hangs with the animation and I see in the console:
Failed to load resource: the server responded with a status of 500 (Internal Server Error) ajax-filter-posts.js?ver=4.8:193 (index):1 Uncaught SyntaxError: Unexpected end of JSON input at JSON.parse (<anonymous>) at XMLHttpRequest.request.onload (ajax-filter-posts.js?ver=4.8:200)
Do you know what might be happening here?
When you want to use this plugin directly in your theme files you have to write something like <?php echo do_shortcode('[ajax_filter_posts post_type="posts" tax="post_category," posts_per_page="16"]', false ); ?>
It would be nice if you can initiate as a function, something like
<?php echo ajax_filter_posts([
'post_type' => 'posts',
'taxonomy' => 'post_category',
'posts_per_page' => 16,
]); ?>
Or maybe even break it up into several shortcodes and functions, as Facet WP does.
Hi,
this is not really an issue but, I wanted to know if it's possible to display all terms even if there is 0 product in one of them.
Currently, if a term is not "linked" with any product, it does not appear in my filter.
Can you tell me if there is a way to do this ? (I couldn't find a hook or something to do this).
Thanks,
Quentin
This is an additional request in #18
rel="next"
to the load more buttonIt would be great if you could sort by ASC and DESC as well as sort by name, date, custom meta fields, etc. using buttons. Would it be possible to add this functionality?
Hi, it's me again :)
I wanted to use url to select a filter when opening the page with the hash.
Ex: when accessing to https://my-website.com/#filter=apple, the ajax filter for "apple" would be automatically applied.
I almost managed to do it, except that, after loading the page through the url hash, when I clicked from one filter to another the ajax requests were duplicated, so the results were not good, I couldn't figured out why.
I don't have time to look into it anymore but I think it could be a good feature !
A user can set a different post type in the AJAX call, which can lead to queries of post types that are not public.
How can we load more data ON SCROLL by disabling: on(container, 'click', '.js-load-more', function(event) {
Thank you
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.