Title: ClemC's Replies | WordPress.org

---

# ClemC

  [  ](https://wordpress.org/support/users/clemc/)

 *   [Profile](https://wordpress.org/support/users/clemc/)
 *   [Topics Started](https://wordpress.org/support/users/clemc/topics/)
 *   [Replies Created](https://wordpress.org/support/users/clemc/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/clemc/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/clemc/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/clemc/engagements/)
 *   [Favorites](https://wordpress.org/support/users/clemc/favorites/)

 Search replies:

## Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WooCommerce] How to add first and last CSS class for Woocommerce layered nav widgets](https://wordpress.org/support/topic/how-to-add-first-and-last-css-class-for-woocommerce-layered-nav-widgets-1/)
 *  Thread Starter [ClemC](https://wordpress.org/support/users/clemc/)
 * (@clemc)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/how-to-add-first-and-last-css-class-for-woocommerce-layered-nav-widgets-1/#post-7068567)
 * OK… jQuery, indeed, makes the life simpler 😀
 *     ```
       jQuery( document ).ready( function( $ ) {
       	$( '.widget_layered_nav' ).wrapAll( '<div id="layered-nav">' );
       } );
       ```
   
 * This works perfectly fine for me.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [How to add first and last CSS class for Woocommerce layered nav widgets](https://wordpress.org/support/topic/how-to-add-first-and-last-css-class-for-woocommerce-layered-nav-widgets/)
 *  Thread Starter [ClemC](https://wordpress.org/support/users/clemc/)
 * (@clemc)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/how-to-add-first-and-last-css-class-for-woocommerce-layered-nav-widgets/#post-7068562)
 * Thank you James, here is the link of the topic on woocommerce support: [https://wordpress.org/support/topic/how-to-add-first-and-last-css-class-for-woocommerce-layered-nav-widgets-1](https://wordpress.org/support/topic/how-to-add-first-and-last-css-class-for-woocommerce-layered-nav-widgets-1)
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WooCommerce] How to add first and last CSS class for Woocommerce layered nav widgets](https://wordpress.org/support/topic/how-to-add-first-and-last-css-class-for-woocommerce-layered-nav-widgets-1/)
 *  Thread Starter [ClemC](https://wordpress.org/support/users/clemc/)
 * (@clemc)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/how-to-add-first-and-last-css-class-for-woocommerce-layered-nav-widgets-1/#post-7068559)
 * I still can css from the first or last widget ID but each of them change depending
   of the current archive page. For exemple in transport category, the first layered
   nav widget will be woocommerce_layered_nav-3, while on bed category, the first
   will be woocommerce_layered_nav-6, etc… Not very elegant and dynamic…
 * But if even you can’t figure out how I can accomplish it using PHP, looks like
   I have to try it with jQuery.
 * Will add the jQuery snippet when I’ve done it to help readers in futur.
 * Also would be very nice if the group of dynamic layered nav widgets would be 
   implemented by defaut in 1 separate element from other aside elements in the 
   sidebar.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WooCommerce] How to add first and last CSS class for Woocommerce layered nav widgets](https://wordpress.org/support/topic/how-to-add-first-and-last-css-class-for-woocommerce-layered-nav-widgets-1/)
 *  Thread Starter [ClemC](https://wordpress.org/support/users/clemc/)
 * (@clemc)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/how-to-add-first-and-last-css-class-for-woocommerce-layered-nav-widgets-1/#post-7068549)
 * Not simple for me since I don’t know JS/jQuery.
 * However, all I need to make this code work is a way to count the total number
   of layered nav widgets displaying on the current archive.
 * Any suggestion how to do that?
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Novice in JS/jQuery need help with this code.](https://wordpress.org/support/topic/novice-in-jsjquery-need-help-with-this-code/)
 *  Thread Starter [ClemC](https://wordpress.org/support/users/clemc/)
 * (@clemc)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/novice-in-jsjquery-need-help-with-this-code/#post-6734446)
 * The problem was with the line where I search the form. It should be this:
 * form = $(this).closest(‘form’);
    parent() returns the parent (and only if it 
   matches the selector specified). On the other hand, closest() searches all ancestors
   and return the first match.
 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [widgets_init actions not fired from functions.php's child theme](https://wordpress.org/support/topic/widgets_init-actions-not-fired-from-functionsphps-child-theme/)
 *  Thread Starter [ClemC](https://wordpress.org/support/users/clemc/)
 * (@clemc)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/widgets_init-actions-not-fired-from-functionsphps-child-theme/#post-6583889)
 * That’s the solution, thank you !

Viewing 6 replies - 1 through 6 (of 6 total)