Forum Replies Created
-
AuthorPosts
-
Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterHi,
Thank you for the details, it helped a lot.
The issue was caused by a custom code snippet in your theme functions.php file, which was used to exclude out of stock items, however it was not working correctly. I have deactivated that, and instead I have added an out of stock filter to make it work properly without any custom code.
Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterHi Geoff,
Thank you very much! I was able to identify the issue, it was actually a yet unknown bug due to a wrong option check. I have corrected a single line of code within Ajax Search Pro to resolve this issue, now it should work fine.
Please make sure to copy the ajax-search-pro plugin directory from staging back to the production so the change is propagated.
I will make sure this issue is permanently resolved within the upcoming version.
Ernest Marcinko
KeymasterGreat! Thank you very much for the feedback, I will make sure to integrate this to the upcoming release 🙂
Ernest Marcinko
KeymasterHi Paul,
This might get a bit tricky, but it is likely possible to some extent via custom code. I have an experimental solution, which hooks into the filters and tries to restrict them to the current possible archive result set.
This is an extract from a possible feature in the upcoming version, but it should do the trick to some extent. Instructions below, but let me know if you need help with it:
function get_available_taxonomy_terms( $taxonomy ) { global $wpdb; // Initialize terms array $terms = []; $cache_key = 'terms_' . $taxonomy; // Get the current queried object $current_queried_object = get_queried_object(); // Check if we're on a term archive if ( is_a( $current_queried_object, 'WP_Term' ) ) { // Update cache key to include the term ID $cache_key .= '_' . $current_queried_object->term_id; // Check transient cache $cached_terms = get_transient( $cache_key ); if ( false !== $cached_terms ) { return $cached_terms; } // Get post IDs in the current category using a custom SQL query $query = $wpdb->prepare( " SELECT DISTINCT tr.object_id FROM {$wpdb->term_relationships} tr INNER JOIN {$wpdb->term_taxonomy} tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy = %s AND tt.term_id = %d ", $current_queried_object->taxonomy, // e.g., 'category' $current_queried_object->term_id ); $post_ids = $wpdb->get_col( $query ); if ( empty( $post_ids ) ) { return []; // No posts in this category, return empty array } // Use get_terms() to get terms associated with these post IDs $terms = get_terms( [ 'taxonomy' => $taxonomy, 'hide_empty' => false, // Include terms even if empty in other contexts 'object_ids' => $post_ids, // Filter by post IDs 'fields' => 'all', ] ); if ( is_wp_error( $terms ) ) { $terms = []; } } else { // Not a term archive, fall back to all terms for the taxonomy $cached_terms = get_transient( $cache_key ); if ( false !== $cached_terms ) { return $cached_terms; } // Get all terms for the taxonomy $terms = get_terms( [ 'taxonomy' => $taxonomy, 'hide_empty' => true, // Only include terms with associated posts 'fields' => 'all', ] ); if ( is_wp_error( $terms ) ) { $terms = []; } } // Cache the results for 1 hour set_transient( $cache_key, $terms, HOUR_IN_SECONDS ); return $terms; } add_filter('asp_fontend_get_taxonomy_terms', function( $terms, $taxonomy, $args, $needed_all ){ return get_available_taxonomy_terms($taxonomy); }, 10, 4);Try adding this code via the Code Snippets plugin or to the functions.php file in your theme/child theme directory – make sure to have a full server back-up first for safety. For more details you can check the safe coding guidelines.
Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterNice work!
Unfortunately automated unchecking of parent checkboxes is not possible at the moment. I usually recommend a custom code snippet where I can, but this might be a bit more complex as not only the checkbox but the state has to be updated so it’s not sent as “checked” to the back-end.
It shouldn’t be too hard to implement though in the code, I will take this as a feature request, I will try to add an option to the back-end to enable this behavior in the upcoming version.
Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterGreat!
It is actually possible, here: https://i.imgur.com/rkydVFs.png
Then use the search shortcode as normal:[wpdreams_asp_settings id=1]Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterHi,
Thanks for the details!
I tried it by clicking on the “Bewerk Live” button, it seems to work all right on my end, I’m getting this editor which seems to be the homepage: https://i.imgur.com/ILIYiqb.png
Ernest Marcinko
KeymasterYou cannot access this content.
-
AuthorPosts