Responsive Select Menu
[resolved] Container css class is replaced instead of added (3 posts)

  1. shortster
    Posted 2 years ago #

    The 'responsiveSelectContainer' class which is added to the menu div container replaces the standard WordPress class of the container.

    For compatibility, a plugin should not interfere with the WordPress added classes of the menu, it should only use them or add to them, not replace them.


  2. sevenspark
    Plugin Author

    Posted 2 years ago #

    No, it does not.

    You can see in the code that this is how the class is added

    $args['container_class'].= ' responsiveSelectContainer';

    it is specifically written to append and not to override, for exactly the reasons you stated.

    If your classes are being replaced, they may have been added in a non-standard way. If they were added via parameters in the wp_nav_menu function as per the WordPress standard, there should be no compatibility issue.

  3. sevenspark
    Plugin Author

    Posted 2 years ago #

    Note that the class that WordPress adds by default is removed automatically by WordPress if the container_class argument is set. That is intended WordPress functionality and isn't something that the plugin is changing - that's just how the core wp_nav_menu code works. In your normal wp_nav_menu() function, simply pass the class that should appear and the RSM class will be appended appropriately.

    Hope that helps,


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Responsive Select Menu
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic