Tagged: 

Viewing 24 posts - 1 through 24 (of 24 total)
  • Author
    Posts
  • #1148344

    Hi there. Is it possible to remove “show all results” from the search module?

    #1148369

    Hey Willem7904,

    Yes, when you edit the Search module you should see the Placeholder setting, just remove the value set there.

    Best regards,
    Nikko

    #1148440

    That 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?

    #1148539

    Hi,

    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.
    #1148621

    Hi Willem7904,

    Did you get it working with tjswarbs78’s suggestion or do you need more help?

    Best regards,
    Victoria

    #1148801

    Hi 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

    #1148953

    Hi 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,
    Victoria

    #1191769

    Hi, 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.

    #1192207

    Hi Sachasilvestri,

    Could you please give us a link to your website, we need more context to be able to help you.

    Best regards,
    Victoria

    #1192208

    Yes, 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.
    #1192209

    always try – if css tips do not work – with !important:

    #top div .av_ajax_search_entry_view_all {
        display: none !important;
    }
    #1192212

    Hi 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.
    #1192259

    What 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:

    #1192391

    Hello Guenni007

    Currently it only shows the expert without date and without comments.
    I make a screen in private.

    Best regards,
    S.

    #1192404

    so 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'>&nbsp;/&nbsp;</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'>&nbsp;/&nbsp;</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/

    #1192405

    by 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 ?

    #1192407

    Hi 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.

    #1192430

    open 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.

    #1207079

    Hi 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.
    #1208635

    Hi,

    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,
    Ismael

    #1208832

    Hi 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

    #1209356

    Hi,
    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,
    Mike

    #1213829

    Thanks Mike, how can I create a filter to remove the word “category” in meta info ?

    #1213863

    Hi,
    I assume that you are talking about the text “category” on a product page under the product details.
    2020-05-17_143803.png
    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');

    2020-05-17_144139.png

    Best regards,
    Mike

Viewing 24 posts - 1 through 24 (of 24 total)
  • You must be logged in to reply to this topic.