Home Forums WoodMart support forum Blog page features not working correctly

Blog page features not working correctly

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #35741

    mjwilson
    Participant

    Hello – I have now found two issues on the blog pages.

    #1 – I have a “search” bar, in the sidebar widget for the blog page, which “should” enable a search for items on the blog itself. However, when I try to search for something on the blog, the search result is for items for sale, on my main site.

    Is there any way to have this search bar only search for blog items, since you are on the blog page, when doing the search?

    #2 – When you are on a post page itself, and at the bottom where it shows links for “Newer” or “Older” posts, they are switched around. Under the “newer” tab, it shows an older post, and under the “older” tab, it shows a newer post. I didn’t see anywhere to change this, within the theme settings, as you can only turn that setting off and on.

    Help!

    Thanks.

    Mj

    #35812

    Artem Temos
    Keymaster

    Hi,

    1. Add this code to the functions.php file in the child theme to be able to choose post type for the search widget http://prntscr.com/i714uy

    $path = get_template_directory() . '/inc/third-party/wph-widget-class.php';
    if ( file_exists( $path ) ) {
    	require_once $path;
    }
    
    class WOODMART_Widget_Search extends WPH_Widget {
    	function __construct() {
    		if( ! woodmart_woocommerce_installed() ) return;
    		$args = array( 
    			'label' => esc_html__( 'WOODMART AJAX Search', 'woodmart' ),
    			'description' =>esc_html__( 'Search form by products with AJAX', 'woodmart' ),
    		 );
    		$args['fields'] = array(
    			array(
    				'id'	=> 'title',
    				'type'  => 'text',
    				'std'   => esc_html__( 'Search products', 'woodmart' ),
    				'name' 	=> esc_html__( 'Title', 'woodmart' )
    			),
    			array(
    				'id'	=> 'search_type',
    				'type'    => 'dropdown',
    				'std'     => 'and',
    				'name'   => esc_html__( 'Search type', 'woodmart' ),
    				'fields' => array(
    					esc_html__( 'Product', 'woodmart' ) => 'product',
    					esc_html__( 'Portfolio', 'woodmart' ) => 'portfolio',
    					esc_html__( 'Post', 'woodmart' ) => 'post'
    				)
    			),
    			array(
    				'id'	=> 'number',
    				'type'  => 'number',
    				'std'   => 4,
    				'name' 	=> esc_html__( 'Number of products to show', 'woodmart' ),
    			),
    			array(
    				'id'	=> 'price',
    				'type'  => 'checkbox',
    				'std'   => 1,
    				'name' 	=> esc_html__( 'Show price', 'woodmart' ),
    			),
    			array(
    				'id'	=> 'thumbnail',
    				'type'  => 'checkbox',
    				'std'   => 1,
    				'name' 	=> esc_html__( 'Show thumbnail', 'woodmart' ),
    			),
    		);
    		$this->create_widget( $args );
    	}
    	function widget( $args, $instance )	{
    		extract($args);
    		echo $before_widget;
    		$number = empty( $instance['number'] ) ? 3 : absint( $instance['number'] );
    		$thumbnail = empty( $instance['thumbnail'] ) ? 0 : absint( $instance['thumbnail'] );
    		$price = empty( $instance['price'] ) ? 0 : absint( $instance['price'] );
    		$search_type = empty( $instance['search_type'] ) ? woodmart_get_opt('search_post_type') : $instance['search_type'];
    
    		if ( $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance ) ) {
    			echo $before_title . $title . $after_title;
    		}
    		$args = array(
    			'count' => $number,
    			'thumbnail' => $thumbnail,
    			'price' => $price,
    		);
    		woodmart_header_block_search_extended( $search_type, false, true, $args ); 
    		echo $after_widget;
    	}
    	function form( $instance ) {
    		parent::form( $instance );
    	}
    }

    2. We will fix this issue in the next theme update.

    Regards

    #36269

    mjwilson
    Participant

    Can this code be added anywhere else? We don’t have a child theme loaded.

    Thanks.

    #36303

    Artem Temos
    Keymaster

    In this case, you need to install and activate the child theme if you want to apply any kind of code customization and prevent losing them after theme updates.

    #37402

    mjwilson
    Participant

    Thanks. I’ll wait for the updated version of the theme!

    #37430

    Artem Temos
    Keymaster

    OK, you are welcome!

    #42120

    mjwilson
    Participant

    I thought this issue was getting fixed in the newest update? I don’t think it works yet? When you search on the blog you still get products.

    #42125

    Artem Temos
    Keymaster

    You just need to keep the code we gave you regarding the search form. We wrote you that we fix the problems with navigation in the update. But search question was not a bug but it is how it works. We will consider adding some more option for that in our future updates but for now just keep the solution we gave you.

    #42127

    mjwilson
    Participant

    Ah…you’re right! You DID fix the “previous/next” issue, with the latest theme update (thank you!)

    We don’t have a child theme loaded yet…we may have to do that.

    Thanks.

    #42148

    Artem Temos
    Keymaster

    OK, contact us if you will have any extra questions.

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