WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce Grid / List toggle
[resolved] Make List View Default Instead of Grid (19 posts)

  1. jefrey1983
    Member
    Posted 1 year ago #

    Hi
    I know this can be done with css but without excerpt, but i want to keep the grid selection and the excerpt.

    Thanks

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

  2. jameskoster
    Member
    Plugin Author

    Posted 1 year ago #

    You can force list view to the the default with a little jQuery;

    jQuery(document).ready(function(){
        jQuery('ul.products').addClass('list');
    });

    That might mess up the active styling on the toggle buttons though so that might need attention too.

  3. jameskoster
    Member
    Plugin Author

    Posted 1 year ago #

    Marking as resolved

  4. wagreen
    Member
    Posted 1 year ago #

    This is because I have no idea what I'm doing, but where do I add the jQuery?

  5. wagreen
    Member
    Posted 1 year ago #

    Nevermind I figured it out.

  6. tlgray
    Member
    Posted 1 year ago #

    Hi

    How did you get this to work?

    Thanks

  7. coinmaster
    Member
    Posted 1 year ago #

    Hey tigray, this will work if you paste the code at the end of jquery.gridlistview.min.js ...

    I'm using this and a CSS display:none; on the toggle switches - my client wanted a list view (without a toggle, go figure) and this was the only way I could achieve it.

  8. toposwope
    Member
    Posted 1 year ago #

    Hi Coinmaster,

    Sorry but I am a bit thick and I keep getting a fatal error whe I try to paste the code...could you help me out and let me know exactly where to paste it..cheers

  9. coinmaster
    Member
    Posted 1 year ago #

    In your plugins directory, you'll have the Woocommerce Grid-List Toggle Plugin - go there, and open the following file:

    assets > js > jquery.gridlistview.min.js

    Put your cursor right at the end of the code there and paste in the code example from above. Save, upload and reload your page.

    Good luck!

  10. toposwope
    Member
    Posted 1 year ago #

    Much appreciated works perfectly!!!

  11. democritus
    Member
    Posted 1 year ago #

    @coinmaster

    I'd like to eliminate my the toggle option also. (i just want list view only on my site) can you explain how you "use this [with] a CSS display:none on the toggle switches"?
    thanks in advance

  12. tlgray
    Member
    Posted 1 year ago #

    Thank you jameskoster for the plugin and coinmaster for the details! Works perfectly!

    democritus - you can hide the toggle switches by adding this to your custom.css

    #gridlist-toggle {
    	 display: none;
     }
  13. democritus
    Member
    Posted 1 year ago #

    that worked, thank you. do i need to add that every time I update wordpress?

  14. garryhoudini
    Member
    Posted 1 year ago #

    @democritus, you'll probably (if @jameskoster won't add this tweak to the plugin) need it only after upgrading the WooCommerce Grid / List toggle plugin. WP core or other plugins don't affect each other.

  15. HorrorUK
    Member
    Posted 1 year ago #

    Great, and simple to use plugin, thank you.

    I've set up list view as the default, but is it possible to swap over the toggle button, as the grid view button is still showing as active when the list view first shows up.

    http://www.tilleystreasures.com

  16. aibrean
    Member
    Posted 1 year ago #

    It's MUCH simpler than that to have list be default. In the plugin editor on the PHP file there is this:

    // Default options
    add_option( 'wc_glt_default', 'grid' );

    Just change to list instead of grid and you're done.

  17. HorrorUK
    Member
    Posted 1 year ago #

    I don't see that line in there for some reason

  18. James
    Member
    Posted 1 year ago #

    Thanks tlgray, just what I needed! I needed to change the '#' at the start of the css code you suggested to a '.' for it to work in my case (maybe that's obvious though?).

    Here's the css to remove the toggle buttons that worked for me - I added this to my custom css file:

    /*Remove grid-list view toggle buttons*/
    .gridlist-toggle {
    	display: none;
    }
  19. hnntrr
    Member
    Posted 1 year ago #

    Any help would greatly be appreciated.

    I recently installed list/grid view plug-in.
    (using woocommerce)

    1. My products are being displayed twice, once at the top and again on the bottom where that list grid toggle button is.

    2. When in grid view. All my items are being displayed in a single column.

    I am very familiar with css. I just can't source the problem.

    Site is http://www.willmetric.com/wbz-hp

    Any help is great appreciated

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic