• Resolved userw

    (@userw)


    hello, is there a way to show the counter in a sidebar bec. it only accepts html and shortcodes.

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

    (@yithemes)

    Hi

    We included a widget that shows items count and wishlist preview in another version of the plugin
    You can take a look to this feature on our landing page ??

    Otherwise, I think you could easly implement a new shortcode that shows items count: here an example code

    if( ! function_exists( 'yith_wcwl_add_items_count_shortcode' ) ){
    	function yith_wcwl_add_items_count_shortcode(){
    		add_shortcode( 'yith_wcwl_items_count', 'yith_wcwl_print_items_count_shortcode' );
    	}
    	add_action( 'init', 'yith_wcwl_add_items_count_shortcode' );
    }
    
    if( ! function_exists( 'yith_wcwl_print_items_count_shortcode' ) ){
    	function yith_wcwl_print_items_count_shortcode(){
    		$count = yith_wcwl_count_products();
    
    		$template = "<span class='yith-wcwl-items-count'>$count</span>";
    
    		return $template;
    	}
    }
    

    This will register [yith_wcwl_items_count] that outputs count of items in wishlist

    Thread Starter userw

    (@userw)

    thanks for that. great plugin by the way.

    Plugin Author YITHEMES

    (@yithemes)

    You’re welcome!

    We are doing our best to improve our plugins. Our target is to develop and release the best free plugins for WooCommerce, but to achieve this we need your help. Please leave a good review to support us and help our growth ??

    Thread Starter userw

    (@userw)

    done

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘counter in widget or shortcode’ is closed to new replies.