WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce Grid / List toggle
[resolved] Hide excerpt text on grid view? (4 posts)

  1. ignaziolaci
    Member
    Posted 1 year ago #

    Hello!
    I'm very happy with the plugin the only thing I can't figure out is how to I hide the excerpt text in grid view?

    http://i.imgur.com/0kxS0.jpg

    The funny thing is that after toggling back and forth between grid and list that text goes away..

    http://i.imgur.com/shiOZ.jpg

    But I'd like that to be always hidden in grid view, not only if i toggle back an forth grid/list.

    Any suggestion is greatly appreciated!
    Thanks!

    http://wordpress.org/extend/plugins/woocommerce-grid-list-toggle/

  2. skyrocker_ss
    Member
    Posted 1 year ago #

    i ran into this as well, and since the author hasn't responded to your post, i decided to look under the hood. i resolved this by modifying the jquery.gridlistview.min.js inside plugins/woocommerce-grid-list-toggle/assets/js

    this is my modified version of this file (replace it all and it should work):

    // The toggle
    jQuery(document).ready(function(){
    function startAsGrid(){
    		jQuery(this).addClass('active');
    		jQuery('#list').removeClass('active');
    		jQuery('ul.products').fadeOut(0, function() {
    			jQuery(this).addClass('grid').removeClass('list').fadeIn(0);
    		});
    		return false;
    };
    startAsGrid();
    jQuery("#grid").click(function(){jQuery(this).addClass("active");jQuery("#list").removeClass("active");jQuery.cookie("gridcookie","grid",{path:"/"});jQuery("ul.products").fadeOut(300,function(){jQuery(this).addClass("grid").removeClass("list").fadeIn(300)});return!1});jQuery("#list").click(function(){jQuery(this).addClass("active");jQuery("#grid").removeClass("active");jQuery.cookie("gridcookie","list",{path:"/"});jQuery("ul.products").fadeOut(300,function(){jQuery(this).removeClass("grid").addClass("list").fadeIn(300)});return!1});jQuery.cookie("gridcookie")&&jQuery("ul.products, #gridlist-toggle").addClass(jQuery.cookie("gridcookie"));if(jQuery.cookie("gridcookie")=="grid"){jQuery("#gridlist-toggle #grid").addClass("active");jQuery("#gridlist-toggle #list").removeClass("active")}if(jQuery.cookie("gridcookie")=="list"){jQuery("#gridlist-toggle #list").addClass("active");jQuery("#gridlist-toggle #grid").removeClass("active")}jQuery("#gridlist-toggle a").click(function(e){e.preventDefault()})});

    all I did was replicate the function that activates the grid view, into a new function called startAsGrid(), and just fire it up first, so the grid view gets selected when entering the page the first time. the reason the plugin doesn't hide the short description when you first go in is because it hasn't been selected yet. So with this function, it just selects it automatically when entering the page.

    Hope this helps while the author updates his source code.

  3. jameskoster
    Member
    Plugin Author

    Posted 1 year ago #

    An easier alternative would be to add the following line directly after jQuery(document).ready(function(){:

    jQuery('ul.products').addClass('grid');

    Which will add the grid class on initial page load. It might interfere with the cookie but I'm not sure without testing.

  4. skyrocker_ss
    Member
    Posted 1 year ago #

    I think I tried it that way, but it didn't work (at least for me), which is why I decided to replicate the function instead and fire it on page load.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic