Tagged: category
-
AuthorPosts
-
October 16, 2019 at 9:09 am #1148344
Hi there. Is it possible to remove “show all results” from the search module?
October 16, 2019 at 10:34 am #1148369Hey Willem7904,
Yes, when you edit the Search module you should see the Placeholder setting, just remove the value set there.
Best regards,
NikkoOctober 16, 2019 at 12:44 pm #1148440That did not solve anything Nikko.
When I type in a search term, the results get displayed in a drop down type display. Below the results there is a link that says “SHOW ALL RESULTS”
I need to remove that. Can you help with that please?
October 16, 2019 at 5:46 pm #1148539Hi,
If you mean the AJAX search you can use some css to hide it.
#top div .ajax_search_entry_view_all {display:none;}
Adding that to your quick css / custom css should sort the problem.
Hope that helps
TJ
- This reply was modified 5 years, 2 months ago by tjswarbs78.
October 16, 2019 at 8:05 pm #1148621Hi Willem7904,
Did you get it working with tjswarbs78’s suggestion or do you need more help?
Best regards,
VictoriaOctober 17, 2019 at 7:33 am #1148801Hi there Victoria
I have added the code to the quick CSS and also cleared my cache. It’s still there
Can you assist please?I am sure it’s just a bit of CSS to correct this
October 17, 2019 at 3:45 pm #1148953Hi Willem7904,
Here is the code you can put in Enfold > General Styling > Quick Css, if it does not work, put into themes/enfold/css/custom.css
body#top > div.av_searchform_element_results .av_ajax_search_entry.av_ajax_search_entry_view_all { display: none; }
If you need further assistance please let us know.
Best regards,
VictoriaMarch 10, 2020 at 11:20 am #1191769Hi, I too would like to hide the same “av_ajax_search_entry.av_ajax_search_entry_view_all” button to avoid redirection to the search results page.
I tried both of the above codes, I tried to insert also in the “custom css” file in enfold, but without result.
Have you found a way to hide it?Best reguards,
S.March 11, 2020 at 11:53 am #1192207Hi Sachasilvestri,
Could you please give us a link to your website, we need more context to be able to help you.
Best regards,
VictoriaMarch 11, 2020 at 11:57 am #1192208Yes, sure:
in private..
In the linked page, you can find the ajax recearch:
It is possible: – hade ” show all button”?
– add publication date?
– add comment count?Best regards,
S.- This reply was modified 4 years, 9 months ago by Marco.
March 11, 2020 at 11:59 am #1192209always try – if css tips do not work – with !important:
#top div .av_ajax_search_entry_view_all { display: none !important; }
March 11, 2020 at 12:04 pm #1192212Hi Guenni007
Perfect! it is run! Many thanks!It is possible add publicaton date and add comment count into preview in ajax recearch?
Best regards,
Sacha- This reply was modified 4 years, 9 months ago by Marco.
March 11, 2020 at 1:23 pm #1192259What do you mean by publication date – the date is shown allready – if there is no excerpt !
So you want to have Excerpt and Time and comment count?
like this:
March 11, 2020 at 6:25 pm #1192391Hello Guenni007
Currently it only shows the expert without date and without comments.
I make a screen in private.Best regards,
S.March 11, 2020 at 7:03 pm #1192404so it is not so easy but because on functions-enfold.php the ajax search function is a “pluggable function” you can have here a child-theme solution. Otherwise you had to have a complete functions-enfold.php in your child.
Every function surrounded by:if(!function_exists('…')){ … }
can be substituted by child-theme function with same name! – because child-theme functions are loaded first – when it comes to the function with the same name in parent theme it does not load the parent function ( because of the if not exists clause)
i have edited that function (on base of enfold 4.7.3) and you can copy & paste that part to your child-theme functions.php
add_action( 'wp_ajax_avia_ajax_search', 'avia_ajax_search' ); add_action( 'wp_ajax_nopriv_avia_ajax_search', 'avia_ajax_search' ); function avia_ajax_search() { global $avia_config; unset($_REQUEST['action']); if(empty($_REQUEST['s'])) $_REQUEST['s'] = array_shift(array_values($_REQUEST)); if(empty($_REQUEST['s'])) die(); $defaults = array('numberposts' => 5, 'post_type' => 'any', 'post_status' => 'publish', 'post_password' => '', 'suppress_filters' => false, 'results_hide_fields' => ''); $_REQUEST['s'] = apply_filters( 'get_search_query', $_REQUEST['s']); $search_parameters = array_merge($defaults, $_REQUEST); if ( $search_parameters['results_hide_fields'] !== '' ) { $search_parameters['results_hide_fields'] = explode(',', $_REQUEST['results_hide_fields']); } else { $search_parameters['results_hide_fields'] = array(); } $search_query = apply_filters('avf_ajax_search_query', http_build_query($search_parameters)); $query_function = apply_filters('avf_ajax_search_function', 'get_posts', $search_query, $search_parameters, $defaults); $posts = (($query_function == 'get_posts') || !function_exists($query_function)) ? get_posts($search_query) : $query_function($search_query, $search_parameters, $defaults); $search_messages = array( 'no_criteria_matched' => __("Sorry, no posts matched your criteria", 'avia_framework'), 'another_search_term' => __("Please try another search term", 'avia_framework'), 'time_format' => get_option('date_format'), 'all_results_query' => http_build_query($_REQUEST), 'all_results_link' => home_url('?' . http_build_query($_REQUEST)), 'view_all_results' => __('View all results','avia_framework') ); $search_messages = apply_filters('avf_ajax_search_messages', $search_messages, $search_query); if(empty($posts)) { $output = "<span class='av_ajax_search_entry ajax_not_found'>"; $output .= "<span class='av_ajax_search_image ".av_icon_string('info')."'>"; $output .= "</span>"; $output .= "<span class='av_ajax_search_content'>"; $output .= "<span class='av_ajax_search_title'>"; $output .= $search_messages['no_criteria_matched']; $output .= "</span>"; $output .= "<span class='ajax_search_excerpt'>"; $output .= $search_messages['another_search_term']; $output .= "</span>"; $output .= "</span>"; $output .= "</span>"; echo $output; die(); } //if we got posts resort them by post type $output = ""; $sorted = array(); $post_type_obj = array(); foreach($posts as $post) { $sorted[$post->post_type][] = $post; if(empty($post_type_obj[$post->post_type])) { $post_type_obj[$post->post_type] = get_post_type_object($post->post_type); } } //now we got everything we need to preapre the output foreach($sorted as $key => $post_type) { // check if post titles are in the hidden fields list if ( ! in_array('post_titles', $search_parameters['results_hide_fields'] ) ) { if(isset($post_type_obj[$key]->labels->name)) { $label = apply_filters('avf_ajax_search_label_names', $post_type_obj[$key]->labels->name); $output .= "<h4>".$label."</h4>"; } else { $output .= "<hr />"; } } foreach($post_type as $post) { $image = ""; $extra_class = ""; // check if image is in the hidden fields list if (!in_array('image', $search_parameters['results_hide_fields'])) { $image = get_the_post_thumbnail($post->ID, 'thumbnail'); $extra_class = $image ? "with_image" : ""; $post_type = $image ? "" : ( get_post_format($post->ID) != "" ? get_post_format($post->ID) : "standard" ); $iconfont = $image ? "" : av_icon_string($post_type); } $excerpt = ""; // two new lines here $the_id = $post->ID; $commentCount = get_comments_number($the_id); // check if post meta fields are in the hidden fields list if ( ! in_array('meta', $search_parameters['results_hide_fields'] ) ) { if(!empty($post->post_excerpt)) { $excerpt = apply_filters( 'avf_ajax_search_excerpt', avia_backend_truncate($post->post_excerpt,70," ","...", true, '', true) ); $excerpt .= "<br class='linebreak'/><span>".get_the_time( $search_messages['time_format'], $post->ID )."</span>"; if ( $commentCount != "0" || comments_open($the_id) && $entry->post_type != 'portfolio') { $link_add = $commentCount === "0" ? "#respond" : "#comments"; $text_add = $commentCount === "1" ? __('Comment', 'avia_framework' ) : __('Comments', 'avia_framework' ); $excerpt .= "<span class='sep'> / </span><span>{$commentCount} {$text_add}</span>"; } } else { $excerpt = apply_filters( 'avf_ajax_search_no_excerpt', get_the_time( $search_messages['time_format'], $post->ID ), $post ); if ( $commentCount != "0" || comments_open($the_id) && $entry->post_type != 'portfolio') { $link_add = $commentCount === "0" ? "#respond" : "#comments"; $text_add = $commentCount === "1" ? __('Comment', 'avia_framework' ) : __('Comments', 'avia_framework' ); $excerpt .= "<span class='sep'> / </span><span>{$commentCount} {$text_add}</span>"; } } } $link = apply_filters('av_custom_url', get_permalink($post->ID), $post); $output .= "<a class ='av_ajax_search_entry {$extra_class}' href='".$link."'>"; if ($image !== "" || $iconfont) { $output .= "<span class='av_ajax_search_image' {$iconfont}>"; $output .= $image; $output .= "</span>"; } $output .= "<span class='av_ajax_search_content'>"; $output .= " <span class='av_ajax_search_title'>"; $output .= get_the_title($post->ID); $output .= " </span>"; if ($excerpt !== '') { $output .= " <span class='ajax_search_excerpt'>"; $output .= $excerpt; $output .= " </span>"; } $output .= "</span>"; $output .= "</a>"; } } $output .= "<a class='av_ajax_search_entry av_ajax_search_entry_view_all' href='".$search_messages['all_results_link']."'>".$search_messages['view_all_results']."</a>"; echo $output; die(); }
because there was a css rule in enfold that sets the breaks in ajax search to display:none
you had to put this in additon to quick css#top #searchform br.linebreak { display: block; }
you can test it here on my playground – put in search : buttons
https://webers-testseite.de/March 11, 2020 at 7:15 pm #1192405by the way – you see there are some filters in that function f.e.: avf_ajax_search_function
maybe a mod knows a filter solution for that ?March 11, 2020 at 7:22 pm #1192407Hi Guenni007!
Many thanks foro your info,
If I understand correctly, the enfold function.php file has undergone many changes, and what I would like to show is already in enfold (not in my enfold child) … correct?If so, I could consider replacing the function.php file and returning the original to the latest version also in the child theme.
also because the personalization could be done again and perhaps in a cleaner way.Or alternatively if something goes wrong, I’ll try your code…
Sincerly,
Sacha.March 11, 2020 at 11:27 pm #1192430open your Enfold 4.7.3 functions-enfold.php with a good text-editor ( be aware there is in parent enfold folder a functions.php and functions-enfold.php )
( for Mac OS X f.e. sublime-text or on Windows notepad++ )
find
/* AJAX SEARCH */ … rules what you like to influence.
you can replace functions-enfold.php in your parent theme by an edited one – but then the next update will overwrite these changes.That is the great benefit of a child-theme. And – as I mentioned above – these pluggable functions can be replaced by a copy of the content in between.
on line 246ff there is:
if(!function_exists('avia_ajax_search')) { … }
so everything in between this wrapping if clause can be copied and transfered to your child-theme functions.php
on the next update of the parent theme, this will not be lost.The disadvantage is that any changes within this function (in your example it is avia_ajax_search ) are not reflected in the update of the parent theme.
The best would certainly be if there was a hook or filter that you could apply to the content here.
But this must always be already implemented in the theme to be able to use it in the child theme.See here for example the usage of some existing filters to influence search:
https://kriesi.at/documentation/enfold/search/Unfortunately I don’t see ( maybe one of the Mods or Devs ) if you can add the Comment Counts in an easier way. But as you see in my example playground that it works this way.
April 25, 2020 at 5:25 pm #1207079Hi All
sorry guys I hope someone can help me, I’m trying to print the meta info of the categories on the display use the php code, the ones that I can insert by drag and drop from avia page builder
I tried to use this php code which I then insert through a short code but it doesn’t work, it doesn’t detect the category names automatically
<?php // Get the ID of a given category $category_id = get_cat_ID( 'Category Name' ); // Get the URL of this category $category_link = get_category_link( $category_id ); ?> <!-- Print a link to this category --> <a href="<?php echo esc_url( $category_link ); ?>" title="Category Name">Category Name</a>
in simple words I would like to know the code that ALB uses for the product meta info module of Plugin Additions to use it via shortcode where I want
Thanks for help
- This reply was modified 4 years, 7 months ago by ptolda.
April 30, 2020 at 8:44 pm #1208635Hi,
Sorry for the delay. You might have to create a custom shortcode or element that can display the categories. Please check the following documentation for more info about shortcodes.
// https://developer.wordpress.org/reference/functions/add_shortcode/
To get the categories, please check this page.
// https://developer.wordpress.org/reference/functions/get_categories/
Best regards,
IsmaelMay 1, 2020 at 1:57 pm #1208832Hi Ismael
I repeat my question, in simple words I would like to know the code that ALB uses for the product meta info module of Plugin Additions.
in short, what is the theme file that generates the code please?
thanks
May 3, 2020 at 11:44 pm #1209356Hi,
Sorry for the late reply, I think you are looking for this file:
\enfold\config-templatebuilder\avia-shortcodes\product_snippets\product_snippet_meta.php
Best regards,
MikeMay 17, 2020 at 5:41 pm #1213829Thanks Mike, how can I create a filter to remove the word “category” in meta info ?
May 17, 2020 at 8:42 pm #1213863Hi,
I assume that you are talking about the text “category” on a product page under the product details.
Try adding this code to the end of your functions.php file in Appearance > Editor:function custom_script(){ ?> <script> (function($){ $(document).ready(function(){ $("#top.single-product .product_meta .posted_in").contents().filter(function(){ return this.nodeType == 3; }).remove(); }); })(jQuery); </script> <?php } add_action('wp_footer', 'custom_script');
Best regards,
Mike -
AuthorPosts
- You must be logged in to reply to this topic.