WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce Grid / List toggle
Exclude from certain pages (5 posts)

  1. sparx
    Member
    Posted 1 year ago #

    I have a shop page that shows a list of categories before you go into the list of products. I don't want to show the toggle on this page as it is not needed, it's only needed once you go into each category of products.

    How do I disable it from showing on my main shop page?

    Many thanks,

    sparx

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

  2. jameskoster
    Member
    Plugin Author

    Posted 1 year ago #

    You'd need to query the depth of the archive then

    remove_action( 'woocommerce_before_shop_loop', array(&$this, 'gridlist_toggle_button'), 20);
  3. sparx
    Member
    Posted 1 year ago #

    Thanks, I tried adding that code to both my theme's functions and in the grid plugins php file, but nothing seems to happen.

    Any thoughts?

    Many thanks is advance,

    sparx

  4. jameskoster
    Member
    Plugin Author

    Posted 1 year ago #

    Sorry the code was wrong, try:

    if ( ! is_product_category() ) {
    remove_action( 'woocommerce_before_shop_loop', 'gridlist_toggle_button', 20);
    }
  5. chronosMark
    Member
    Posted 1 year ago #

    Hi I've just tried using

    remove_action( 'woocommerce_before_shop_loop', 'gridlist_toggle_button', 20);

    and it dosen't work. Neither does trying to use add_action hook on another tag. Am I correct that just specifiying this in the functions.php of my theme should work?

    I'm trying to move the button to before the main content so I figured remove the action using the above and then do

    remove_action( 'woocommerce_before_main_content', 'gridlist_toggle_button', 20, 0);

    is this the correct way to go about it?

    Thanks,

    Mark

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.