Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Results count
This topic contains 7 replies, has 2 voices, and was last updated by Ernest Marcinko 1 year, 8 months ago.
- AuthorPosts
- August 10, 2022 at 10:44 am #38792
Hello,
I want to display the results information box on the results page after each search
Resultat pour <strong>{phrase}</strong> (<strong>{results_count}</strong> de <strong>{results_count_total}</strong>)
You can tell me where to add it, and I can do it.
Thank you for your help.
August 10, 2022 at 12:27 pm #38795Hi,
I can try to help you adding that, but first, make sure you are using a child theme from your original theme – so I will not try to modify the original theme files.
I tried to login to the backend, but the wp-admin and wp-login.php URLs are disabled, so I can’t. Can you please also add temporary FTP access, so I can make direct changes to the theme files?
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
August 17, 2022 at 9:40 pm #38929You cannot access this content.August 18, 2022 at 10:22 am #38940Thank you!
I have added the following code to the functions.php file in the child theme directory:
add_action( 'elementor/widget/render_content', function( $content, $widget ){ // $content (string) = the rendered content of the widget; widget = the data object global $wp_query; if ($widget->get_name() === 'heading' && is_search() && !is_404() ) { // your targeted widget //return "<h1>Resultat pour <strong>" . get_search_query() . "</strong> (<strong>".$wp_query->post_count."</strong> de <strong>".$wp_query->found_posts."</strong>)</h1>"; $settings = $widget->get_settings_for_display(); if ( '' === $settings['title'] ) { return; } $widget->add_render_attribute( 'title', 'class', 'elementor-heading-title' ); if ( ! empty( $settings['size'] ) ) { $widget->add_render_attribute( 'title', 'class', 'elementor-size-' . $settings['size'] ); } //$title = $settings['title']; $title = "Resultat pour '<strong>" . get_search_query() . "</strong>' (<strong>".$wp_query->post_count."</strong> de <strong>".$wp_query->found_posts."</strong>)"; if ( ! empty( $settings['link']['url'] ) ) { $widget->add_link_attributes( 'url', $settings['link'] ); $title = sprintf( '<a %1$s>%2$s</a>', $widget->get_render_attribute_string( 'url' ), $title ); } return sprintf( '<%1$s %2$s>%3$s</%1$s>', Elementor\Utils::validate_html_tag( $settings['header_size'] ), $widget->get_render_attribute_string( 'title' ), $title ); } return $content; }, 10, 2 );
This changes the title.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
August 18, 2022 at 11:36 am #38949You cannot access this content.August 18, 2022 at 12:03 pm #38954Hi,
You are welcome.
By default the plugin width is set to 100%, which means it follows the width of the container element – if that changes, then the plugin width also changes.
Best,
You can set the width to a fixed px value here: https://i.imgur.com/Xw5BTDj.png
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
August 18, 2022 at 12:37 pm #38957Thank you for help.
Good support, you can close the topic.
August 18, 2022 at 12:38 pm #38959You cannot access this content. Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
The topic ‘Results count’ is closed to new replies.