Forum Replies Created
-
AuthorPosts
-
Ernest Marcinko
KeymasterHi,
Can you please add temporary back-end details so I can take a look at the issue? Thank you!
Ernest Marcinko
KeymasterSure!
There are no exact tutorials as each and every theme is very different. But you can check out some of the video tutorials from this page, as well as from our official youtube channel.
Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterHi,
If you are planning to use elementor loop grid, here is a very extensive video tutorial on how to do that.
Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterHi!
Thank you for choosing our search engine, you won’t regret it!
Usually most themes have a theme editor. Have you tried to use the theme editor to replace the search with the ajax search pro shortcode?
Ernest Marcinko
KeymasterYou are very welcome!
This I probably can’t integrate, as it would require a lot of settings to configure correctly.
Keep the code snippets, they will work even after update. The best place to have them is by using the Code Snippets plugin. It keeps them active inbetween updates as well.
March 12, 2025 at 2:37 pm in reply to: No search results in secondary language using Polylang #53313Ernest Marcinko
KeymasterYou cannot access this content.
March 12, 2025 at 2:33 pm in reply to: No search results in secondary language using Polylang #53310Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterThank you!
I think I actually got it. There was a tiny mistake in the last code snippet, I fixed it, now it seems to show the context correctly. Please note that this is not perfect, but it should work in most cases. I can’t guarantee anything though, as this is beyond normal support, but I think it should work all right.
For future reference, the complete current solution is:
add_filter( 'asp_results', 'asp_get_attachment_to_product_content', 10, 4 ); function asp_get_attachment_to_product_content( $results, $search_id, $is_ajax, $args ) { // --- DO NOT CHANGE ANYTHING BELOW --- foreach ( $results as $k =>&$r ) { if ( $r->post_type !== 'product' ) { continue; } $product = wc_get_product( $r->id); if ( $product->is_downloadable() ) { // Loop through WC_Product_Download objects foreach ( $product->get_downloads() as $key_download_id => $download ) { $download_link = $download->get_file(); // File Url $id = asp_get_file_id_from_url($download_link); if ( $id !== '' ) { $field_value = get_post_meta( $id, '_asp_attachment_text', true ); if ( $field_value !== '' ) { $r->content = \WPDRMS\ASP\Utils\Str::getContext($field_value, 200, 9999999, $args['s'], explode(' ', $args['s'])); break; } } } } } return $results; } function asp_get_file_id_from_url($file_url) { $file_path = ltrim(str_replace(wp_upload_dir()['baseurl'], '', $file_url), '/'); global $wpdb; $statement = $wpdb->prepare("SELECT <code>ID</code> FROM <code>wp_posts</code> WHERE guid='%s';", $file_url, $file_path); $attachment = $wpdb->get_col($statement); if (count($attachment) < 1) { return ''; } return $attachment[0]; } add_filter( 'asp_post_content_before_tokenize', function ( $content, $post ) { if ( $post->post_type !== 'product' ) { return $content; } $product = wc_get_product( $post->ID ); if ( $product->is_downloadable() ) { // Loop through WC_Product_Download objects foreach ( $product->get_downloads() as $key_download_id => $download ) { $download_link = $download->get_file(); // File Url $id = asp_get_file_id_from_url($download_link); var_dump($id, $download_link); if ( $id !== '' ) { $field_value = get_post_meta( $id, '_asp_attachment_text', true ); if ( $field_value !== '' ) { $content .= ' ' . $field_value; } } } } return $content; }, 10, 2 );March 12, 2025 at 1:59 pm in reply to: No search results in secondary language using Polylang #53306Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterI see, I’m not sure if that’s possible, but let’s try to correct the code on site.
Can you please check the back-end access details? I tried to log-in but username/pass is incorrect. Thank you!
Ernest Marcinko
KeymasterYou cannot access this content.
Ernest Marcinko
KeymasterYea, okay. I checked the event handler, it does not re-attach when the items are reloaded unfortunately. I have extracted their code to re-attach the event listener, I hope they can fix it in the future. For now, use this custom code:
add_action( 'wp_footer', function () { ?> <script> jQuery(function() { const handler = function(e) { var wrapper = jQuery(this) , url = wrapper.data('column-clickable'); if (url) { if (jQuery(e.target).filter('a, a *, .no-link, .no-link *').length) { return true; } if (url.match("^#elementor-action")) { let hash = url; hash = decodeURIComponent(hash); if (hash.includes("elementor-action:action=popup:open") || hash.includes("elementor-action:action=lightbox")) { if (0 === wrapper.find('#make-column-clickable-open-dynamic').length) { wrapper.append('<a id="make-column-clickable-open-dynamic" style="display: none !important;" href="' + url + '">Open dynamic content</a>'); } wrapper.find('#make-column-clickable-open-dynamic').click(); return true; } return true; } if (url.match("^#")) { let hash = url; jQuery('html, body').animate({ scrollTop: jQuery(hash).offset().top }, 800, function() { window.location.hash = hash; }); return true; } window.open(url, wrapper.data('column-clickable-blank')); return false; } } document.querySelectorAll(".asp_main_container").forEach((el) => { el.addEventListener("asp_search_end", (event) => { jQuery(document).on('click', 'body:not(.elementor-editor-active) .make-column-clickable-elementor', handler); }); }); }); </script> <?php }, 999 );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
KeymasterI see. On the screenshot however it seems to be the first 130characters of the PDF content though, so that is correct. I guess you want like the context around the search keyword? For that maybe try this variation, but I’m not sure if that’s even possible:
add_filter( 'asp_results', 'asp_get_attachment_to_product_content', 10, 4 ); function asp_get_attachment_to_product_content( $results, $search_id, $is_ajax, $args ) { // --- DO NOT CHANGE ANYTHING BELOW --- foreach ( $results as $k =>&$r ) { if ( $r->post_type !== 'product' ) { continue; } $product = wc_get_product( $r->id); if ( $product->is_downloadable() ) { // Loop through WC_Product_Download objects foreach ( $product->get_downloads() as $key_download_id => $download ) { $download_link = $download->get_file(); // File Url $id = asp_get_file_id_from_url($download_link); if ( $id !== '' ) { $field_value = get_post_meta( $id, '_asp_attachment_text', true ); if ( $field_value !== '' ) { $r->content = \WPDRMS\ASP\Utils\Str::getContext($field_value, 130, 9999999, $args['s'], explode($args['s'])); break; } } } } } return $results; } -
AuthorPosts