Forums Forums Search & Filter Pro Integrate with theme search ?

Viewing 8 posts - 1 through 8 (of 8 total)
  • Anonymous
    #207257

    Hi There,

    I’m trying to integrate the plugin with woostify free theme.

    Ideally when using the themes search form I’d like the page with the filters displayed (and the same layout to products)

    I’ve tried using the advanced settings for force is_search or is_archive , neither do the trick unfortunately.

    Here’s examples

    If you go here and try the search in the header – https://vstplugins.xyz/ the results come from search.php template (this is not the desired layout.)

    Then try this page https://vstplugins.xyz/brand/audiomodern/ and use the search from the plugin in the sidebar , this gives the desired results , I’m struggling to track down what template this uses.

    Any idea how I might integrate the main search input with the plugins filters ? Ideally I won’t have a search input in the sidebar and will just use the one in the header.

    Thank very much !

    Stu

    Trevor
    #207270

    You would probably need some code (something like that shown below). This needs to be inside the child theme functions.php file. You would need to be using a child theme, otherwise any theme update will overwrite the changes. Orbisius have a child theme maker plugin that is really simple to use (just accept the default settings, after done, remove the Orbisius plugin).

    https://wordpress.org/plugins/orbisius-child-theme-creator/

    function sandf_change_search_url_rewrite() {
    	if ( is_search() && ! empty( $_GET['s'] ) ) {
    		wp_redirect( home_url( "shop/?_sf_s=" ) . urlencode( get_query_var( 's' ) ) );
    		exit();
    	}	
    }
    add_action( 'template_redirect', 'sandf_change_search_url_rewrite' );
    Anonymous
    #207274

    Hey Trevor,

    Thanks for the speedy reply, I gave this a go it didn’t quite do the trick .

    I get these errors –

    Warning: Cannot modify header information – headers already sent by (output started at /var/sites/v/vstplugins.xyz/public_html/wp-content/themes/woostify-child/functions.php:30) in /var/sites/v/vstplugins.xyz/public_html/wp-includes/pluggable.php on line 1251

    Warning: Cannot modify header information – headers already sent by (output started at /……/public_html/wp-content/themes/woostify-child/functions.php:30) in /……./vstplugins.xyz/public_html/wp-includes/pluggable.php on line 1254

    The code on pluggable.php it doesn’t like is as follows , line 1251 starts with ‘header( “X-Redirect-By’

    /**
    * Filters the X-Redirect-By header.
    *
    * Allows applications to identify themselves when they’re doing a redirect.
    *
    * @since 5.1.0
    *
    * @param string $x_redirect_by The application doing the redirect.
    * @param int $status Status code to use.
    * @param string $location The path to redirect to.
    */
    $x_redirect_by = apply_filters( ‘x_redirect_by’, $x_redirect_by, $status, $location );
    if ( is_string( $x_redirect_by ) ) {
    header( “X-Redirect-By: $x_redirect_by” );
    }

    header( “Location: $location”, true, $status );

    return true;
    }
    endif;

    Sorry to be a pain, but any ideas?

    Thanks,
    Stu

    Trevor
    #207276

    Does it get as far as changing the URL?

    Anonymous
    #207278

    Does’t appear to ..

    Url stays as ‘s=’

    https://vstplugins.xyz/?s=audio

    Trevor
    #207285

    Mmm.

    Assuming that the search is in the header, if you edit the header.php file, is the form in there, or maybe a file called searchform.php?

    Anonymous
    #207296

    It appears to be coming from here –

    ./inc/woostify-template-functions.php:1302:

    From what I can gather this is the form ?

    if ( ! function_exists( 'woostify_dialog_search' ) ) {
    	/**
    	 * Display Dialog Search
    	 *
    	 * @uses  woostify_is_woocommerce_activated() check if WooCommerce is activated
    	 * @return void
    	 */
    	function woostify_dialog_search() {
    		$options = woostify_options( false );
    
    		if ( false == $options['header_search_icon'] ) {
    			return;
    		}
    
    		$title_icon = apply_filters( 'woostify_dialog_search_title_icon', WOOSTIFY_THEME_URI . 'assets/images/logo.svg' );
    		$close_icon = apply_filters( 'woostify_dialog_search_close_icon', 'ti-close' );
    		?>
    
    		<div class="site-dialog-search">
    			<div class="dialog-search-content">
    				<?php do_action( 'woostify_dialog_search_before' ); ?>
    
    				<div class="dialog-search-header">
    					<?php if ( false != $title_icon ) { ?>
    						<span class="dialog-search-icon">
    							<img src="<?php echo esc_url( $title_icon ); ?>" alt="<?php esc_attr_e( 'Dialog search icon', 'woostify' ); ?>">
    						</span>
    					<?php } ?>
    
    					<span class="dialog-search-title"><?php esc_html_e( 'Type to search', 'woostify' ); ?></span>
    
    					<span class="dialog-search-close-icon <?php echo esc_attr( $close_icon ); ?>"></span>
    				</div>
    				<div class="dialog-search-main">
    					<?php
    					if ( false == $options['header_search_only_product'] ) {
    						get_search_form();
    					} elseif ( woostify_is_woocommerce_activated() ) {
    						the_widget( 'WC_Widget_Product_Search', 'title=' );
    					}
    					?>
    				</div>
    
    				<?php do_action( 'woostify_dialog_search_after' ); ?>
    			</div>
    		</div>

    Does that help ?

    thanks,
    Stu

    Anonymous
    #207298

    Hi there, all sorted now, I looked at your code and realised I had changed the base url from shop to something else. Looks like the code depended on it being shop , I reverted it to shop and now all is perfect !

    Thanks so much for your help on this , I’ll be sure to leave a good review for you on envato.

    Stu

Viewing 8 posts - 1 through 8 (of 8 total)