Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Search box swapping › Reply To: Search box swapping
March 7, 2022 at 8:34 am
#37060
Keymaster
That should work, unless there is some sort of a custom code or a different plugin overriding the search.
You can try a custom code to forcefully deregister the flatsome search shortcode, and replace it with ASP. Try adding this code 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.
function search_shortcode2($atts) {
extract(shortcode_atts(array(
'size' => 'normal',
'style' => '',
'class' => '',
'visibility' => ''
), $atts));
$classes = array( 'searchform-wrapper' , 'ux-search-box', 'relative' );
if( $class ) $classes[] = $class;
if( $visibility ) $classes[] = $visibility;
if( $style ) $classes[] = 'form-'.$style;
if( $size ) $classes[] = 'is-'.$size;
$classes = implode(' ', $classes);
ob_start();
echo '<div class="'. $classes. '">';
echo do_shortcode('[wd_asp id=1]');
echo '</div>';
$content = ob_get_contents();
ob_end_clean();
return $content;
}
remove_shortcode("search");
add_shortcode("search", "search_shortcode2");