Snippets: Custom Togglebar Toggle Link for Main Menu

This snippet allows you to create a custom class you can use to open/close the toggle bar right from your main header menu. Simply add the code, alter the "my-topbar-toggle" classname to whatever you want and now you can use that classname in your custom menu.

add_action( 'wp_footer', function() { ?>

	<script>
		( function( $ ) {
			'use strict';
				$( '.my-topbar-toggle a' ).click( function() {
					$( '#toggle-bar-wrap' ).toggleClass( 'active-bar' );
				} );
		} ) ( jQuery );
	</script>

<?php } );

Result: