WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Hide excerpt text on grid view?

[Resolved] Hide excerpt text on grid view?

Viewing 3 replies - 1 through 3 (of 3 total)
  • 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.

    Plugin Author James Koster

    @jameskoster

    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.

    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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Hide excerpt text on grid view?’ is closed to new replies.