• Resolved Mark Smallman

    (@marks99)


    Hi, I am Working on a custom site build.
    Within a custom header area, we are adding a logo we need to change the class for, if the Wishlist contains items.
    I created something similar for the WC cart, see: https://gist.github.com/macgraphic/69976d6c79ca4e616af235b8c12bcb49
    Looking through the topics here & plugin files, but cannot see anything that would help create something similar for Wishlist.
    Anything I found & tried either crashed site, or seems to be out of date and no longer works. – including trying TInvWL_Public_WishlistCounter::counter > 0

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author templateinvaders

    (@templateinvaders)

    Hi @marks99

    It should be TInvWL_Public_WishlistCounter::counter()
    This method returns the number of products on a wishlist for the current user.

    Thread Starter Mark Smallman

    (@marks99)

    Fixed, Many thanks.
    I had tried this already, but must have mistyped it or something.

    For anyone else, trying to do the same, here’s the way I set this (in the theme functions.php)

    function onze_wishlist_has_items( $haswishitems ) {
    	if ( TInvWL_Public_WishlistCounter::counter() >= 1 ) {
    		$haswishitems[] = 'hasWishlistItems';
    	}
    	return $haswishitems;
    }
    add_filter( 'body_class','onze_wishlist_has_items' );
    • This reply was modified 2 years, 5 months ago by Mark Smallman.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘If ( Wishlist has items )’ is closed to new replies.