• Resolved danielmlt

    (@danielmlt)


    i’d like to modify the html of the default price slider but it’s not possible to access it without hacking the plugin or other nasty tricks.

    suggestion:

    implement add_filter for price slider html.

    example implementation:

    add_filter('woof_price_slider_html', array(this, 'woof_price_slider_html'));
    
    function woof_price_slider_html($args) {
    
    	return '<form method="get" action="' . esc_url($args['form_action']) . '">
    
    		<div class="price_slider_wrapper">
    
    			<div class="price_slider" style="display:none;"></div>
    
    			<div class="price_slider_amount">
    
    				<input type="text" id="min_price" name="min_price" value="' . esc_attr($args['min_price']) . '" data-min="' . esc_attr(apply_filters('woocommerce_price_filter_widget_amount', $args['min'])) . '" placeholder="' . __('Min price', 'woocommerce') . '" />
    
    				<input type="text" id="max_price" name="max_price" value="' . esc_attr($args['max_price']) . '" data-max="' . esc_attr(apply_filters('woocommerce_price_filter_widget_amount', $args['max'])) . '" placeholder="' . __('Max price', 'woocommerce') . '" />
    
    				<button type="submit" class="button">' . __('Filter', 'woocommerce') . '</button>
    
    				<div class="price_label" style="display:none;">
    
    					' . __('Price:', 'woocommerce') . ' <span class="from"></span> — <span class="to"></span>
    
    				</div>
    
    				' . $args['fields'] . '
    
    				<div class="clear"></div>
    
    			</div>
    
    		</div>
    
    	</form>';
    }

    Edit: I guess I mean implement apply_filters. i’m not a plugin developer. Just make it hookable ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author RealMag777

    (@realmag777)

    Thank you for cooperation ??

    Plugin Author RealMag777

    (@realmag777)

    Hello

    I did it in wp-content\plugins\woocommerce-products-filter\classes\helper.php html code for form replaced to:

    $price_slider_html = '<form method="get" action="' . esc_url($form_action) . '">
    			<div class="price_slider_wrapper">
    				<div class="price_slider" style="display:none;"></div>
    				<div class="price_slider_amount">
    					<input type="text" id="min_price" name="min_price" value="' . esc_attr($min_price) . '" data-min="' . esc_attr(apply_filters('woocommerce_price_filter_widget_amount', $min)) . '" placeholder="' . __('Min price', 'woocommerce') . '" />
    					<input type="text" id="max_price" name="max_price" value="' . esc_attr($max_price) . '" data-max="' . esc_attr(apply_filters('woocommerce_price_filter_widget_amount', $max)) . '" placeholder="' . __('Max price', 'woocommerce') . '" />
    					<button type="submit" class="button">' . __('Filter', 'woocommerce') . '</button>
    					<div class="price_label" style="display:none;">
    						' . __('Price:', 'woocommerce') . ' <span class="from"></span> &mdash; <span class="to"></span>
    					</div>
    					' . $fields . '
    					<div class="clear"></div>
    				</div>
    			</div>
    		</form>';
    
            $price_slider_data = array(
                'form_action' => esc_url($form_action),
                'min_price' => esc_attr($min_price),
                'max_price' => esc_attr($max_price),
                'fields' => $fields
            );
            $price_slider_html = apply_filters('woof_price_slider_html', $price_slider_html, $price_slider_data);
            echo $price_slider_html;
    Thread Starter danielmlt

    (@danielmlt)

    thank you, you’re awesome!

    Plugin Author RealMag777

    (@realmag777)

    Welcome ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘add_filter for price slider html’ is closed to new replies.