Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #230957

    Gettting Google powered search on Enfold is fairly easy- Just need to get custom google search engine code and paste it in place of WP search function in copy of search.php in child theme. check following video for instructions:

    The theme’s search boxes work with it. Just 2 small things,
    1. How to disable the ajax search script in the header the header search box so it behaves just like the standard widget search box. While the header ajax search script doesn’t return results, it is still interfering and processing while typing in the box.

    2. How to remove number of results in the H1 entry title, for example it shows as this:
    10 Search results for: testing
    but google custom search returns 30 results so obviously that number 10 is coming from internal search results number. So could I remove the quantity number so that it show simply as: Search results for: testing

    Thank you for your help!

    #231044

    Hey ttem!

    1) Insert this code at the bottom of functions.php

    
    add_filter('avf_frontend_search_form_param', 'avia_deactivate_ajax_search',10,1);
    function avia_deactivate_ajax_search($params)
    {
    	$params['ajax_disable'] = true;
    	return $params;
    }
    

    2) Insert this code into the functions.php file:

    
    add_filter('avf_which_archive_output', 'avia_change_archive_title',10,1);
    
    function avia_change_archive_title($output)
    {
    	if (strpos(strtolower($output), 'search results for') !== false) {
    		$output = __('Search results for:','avia_framework')." ".esc_attr( get_search_query() );
    	}
    	return $output;
    }
    

    Regards,
    Peter

    #231133

    Perfect! Thank you Peter!! Google powered search rocks! misspellings, semantic matches so much superior

    Here’s some CSS adjustments to the Google results page I made that may help others:

    .gsc-resultsHeader {display: none;}
    .gsc-orderby-container {display: none;}
    .gs-bidi-start-align {padding-left: 7px;}
    .gsc-thumbnail{padding: 8px 0 11px 8px;}

    Customization to results styles can be made at your Google CSE interface.

    Subscribe to the ads-free results and you may also remove Google branding:
    .gcsc-branding {display: none;}

    Note in search.php I inserted the google search script in lieu of the existing search replacing lines 21-47:

    <section class="search_form_field">
                                <?php
                                echo "<h4>".__('New Search','avia_framework')."</h4>";
                                echo "<p>".__('If you are not happy with the results below please do another search','avia_framework')."</p>";
    
                                get_search_form();
                                echo "<span class='author-extra-border'></span>";
                                ?>
                            </section>
                        </div>
    
                        <?php
                        if(!empty($_GET['s']))
                        {
                            echo "<h4 class='extra-mini-title widgettitle'>{$results}</h4>";
    
                            /* Run the loop to output the posts.
                            * If you want to overload this in a child theme then include a file
                            * called loop-search.php and that will be used instead.
                            */
                            $more = 0;
                            get_template_part( 'includes/loop', 'search' );
    
                        }
    
                        ?>

    Hope this will help other Enfold aficionados :)

    #231485

    Hi!

    Thank you for the feedback!

    Cheers!
    Peter

    #308978

    ttem – this was extremely helpful… However the code to disable ajax functionality did not work for me. Any ideas?

    #309144

    Hi,

    Try directly changing that parameter in searchform.php, look for line:

    'ajax_disable'	=> false
    

    Replace it by:

    'ajax_disable'	=> true
    

    Regards,
    Josue

    #341203

    google has a new script and CSE doesn’t show up in enfold. No idea why but it is simply isn’t showing even if I copy to code into a text widget…

    #341260

    Hey!

    Can you paste the code you are trying to put?

    Best regards,
    Josue

    #341586
    This reply has been marked as private.
    #341587
    This reply has been marked as private.
    #341589
    This reply has been marked as private.
Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘How to Integrate Google Custom Search (CSE) into Enfold’ is closed to new replies.