Jonathan Daggerhart
Forum Replies Created
-
I’ve pushed a fix and created a new release (1.5.53): https://github.com/daggerhart/query-wrangler/pull/25
Let me know how this works out, and if you have any other issues.
Thanks!
I believe this is a bug. The Field for the post type override allows for checking multiple values, so this handler should account for
get_query_var('post_type')
to be an array.I’ll make a fix and release an update. Might take me ~ an hour or so.
Forum: Plugins
In reply to: [Query Wrangler] Will There Be a 5.9.x UpdateHi jkearthwood,
Yes it’s still supported, just a bit passively. I fix reporters bugs and add features as they come up in this forum.
I’ll test it out a bit in 5.9+ over the next few days and make a new release so people know it’s supported.
Thanks for the heads up, didn’t realize it had been 9 months.
Forum: Plugins
In reply to: [Query Wrangler] Support for 5.8?That’s for the update. All looks good on my end as well.
Created a new release with a minor css improvement, and stated it was tested w/ 5.8.
Thanks for the nudge, I’ve needed to updated the Tested information for a few versions now.
Forum: Plugins
In reply to: [Query Wrangler] Support for 5.8?Hi whereverpanda,
Yes, it should work. I’ll do some more testing. If I find any issues w/ 5.8 I’ll fix them. And either way, I’ll make a release that mentions working w/ 5.8
Forum: Plugins
In reply to: [Query Wrangler] Page breakage when used with ElementorHi Gizant,
1.5.50 didn’t exist before you posted. I fixed the issue and made the new version thanks to you reporting the issue.
And glad to hear it’s all fixed!
Let me know if you run into other issues,
JonathanForum: Plugins
In reply to: [Query Wrangler] Page breakage when used with ElementorHi Gizant,
Thanks for the report! I’ve just released a fix for this bug (version 1.5.50). Please let me know if you run into any other issues.
Jonathan
Forum: Plugins
In reply to: [Query Wrangler] Hide Header/Footer if there are no resultsHi whereverpanda,
I’ve added this feature and pushed out a new release (1.5.49). When editing the header or footer for a query, there is a checkbox that says “Hide if query has no results” (or similar). Checking that box should do what you need.
Let me know if you run into any issues, and thanks for the kind words.
Forum: Plugins
In reply to: [Query Wrangler] Category queryHi Sem90,
There are a few filters that should work for you. I recommend adding the filter “Taxonomy: Categories”. Once you add that to the query, click on the new filter added to the query to edit it, then check the box for the category you want to filter by.
Let me know if you run into any issues.
Thanks for the heads up!
I’ve published an update to the plugin that resolves this issue (2.3.9). Please let me know if you run into other problems.
Forum: Plugins
In reply to: [Query Wrangler] Filter by post IDHi Mikeoc,
The post ID filters have an undocumented feature that should work for you, “contextual tokens”.
In the value for the post ID filter, try using this:
{{post:ID}}
Let me know how that works out, and thanks for the kind words!
Jonathan
Awesome! Thanks for letting me know
Forum: Plugins
In reply to: [Query Wrangler] Add FilterHi @henderson7,
There are a couple of ways to go about creating a new filter, just depends on how complicated you want to get with it.
1. Simple new filter with no options
When this is added to a query this will automatically add the parameter “author = current user ID”.<?php // Register new filter with Query Wrangler. add_filter( 'qw_filters', 'qw_filter_author_is_current' ); function qw_filter_author_is_current( $filters ) { $filters['author_is_current'] = array( 'title' => 'Author is current user', 'description' => 'Filter posts by current user as the post author', 'query_args_callback' => 'qw_generate_query_args_author_is_current', 'query_display_types' => array( 'page', 'widget' ), ); return $filters; } // Modify the query arguments before the query is executed. function qw_generate_query_args_author_is_current( &$args, $filter ) { $args['author'] = get_current_user_id(); }
2. Slightly more complicated, a filter with options
This version let’s you choose the between “Is current user” and “Is Not current user”.
<?php // Register new filter with Query Wrangler. add_filter( 'qw_filters', 'qw_filter_author_is_current' ); function qw_filter_author_is_current( $filters ) { $filters['author_is_current'] = array( 'title' => 'Author is current user', 'description' => 'Filter posts by current user as the post author', 'query_args_callback' => 'qw_generate_query_args_author_is_current', 'query_display_types' => array( 'page', 'widget' ), 'form_callback' => 'qw_filter_author_is_current_form', ); return $filters; } // Provide an option form for the filter. function qw_filter_author_is_current_form( $filter ) { if ( empty( $filter['values']['operator'] ) ) { $filter['values']['operator'] = 'author__in'; } ?> <strong>Operator:</strong> <select class="qw-field-value qw-js-title" name="<?php print $filter['form_prefix']; ?>[operator]"> <option value="author__in" <?php selected( $filter['values']['operator'], 'author__in' ) ?>> Author is current user </option> <option value="author__not_in" <?php selected( $filter['values']['operator'], 'author__not_in' ) ?>> Author is NOT current user </option> </select> <?php } // Modify the query arguments before the query is executed. function qw_generate_query_args_author_is_current( &$args, $filter ) { if ( empty( $filter['values']['operator'] ) ) { $filter['values']['operator'] = 'author__in'; } $args[ $filter['values']['operator'] ] = [ get_current_user_id() ]; }
3. Use the existing “Callback” filter, and provide it with a simple function.
This is the simplest way to go, but is a little more brittle than providing an actual new QW filter.
function my_custom_callback_author_is_current( $args, $filter ) { $args['author'] = get_current_user_id(); return $args; }
—-
Hope this helps. I’m also happy to add something like this to the plugin if you’d like. Depending on your level of comfort, you’re welcome to submit a pull request to the GitHub repo (https://github.com/daggerhart/query-wrangler), or I can create it.
– Another filter example: https://github.com/daggerhart/query-wrangler/blob/master/docs/examples/filter.md
Forum: Plugins
In reply to: [Query Wrangler] New Version Pagination IssueThanks for the report. I’ve pushed a new version that attempts to fix this (1.5.48), could you please test it and let me know if it fixes pagination on queries without offset?
Forum: Plugins
In reply to: [Query Wrangler] 1.5.45 breaks pagesYep, you’re totally right, and thanks for reporting. I’ve updated again to 1.5.46.
Please download that and let me know if it fixes all issues.