How to add the Bellows accordion menu to your WordPress site via PHP
Main usage scenarios
If you’re adding an accordion menu directly into your theme template, you’ll want to use the Bellows PHP API functions. These functions are also useful if you’re adding the accordion menu via filter or action hook.
Generating the PHP
To generate the code for a standard Bellows menu, visit your Control Panel and click on the tab for the Configuration you wish to use for this menu. Click on the Integration section.
Choose the menu (created in Appearance > Menus) that you wish to display under Integrate Specific Menu. The PHP and Shortcode codes will update to use the menu you’ve chosen.
If you want to use a theme location you’ve registered instead, you can choose that.
Click on the PHP code to highlight it. Then copy the code
Paste the code in your theme template to use it
<?php bellows( 'main' , array( 'menu' => 26 ) ); ?>
Ideally, you should check that the
bellows() function exists before calling it, to avoid creating a plugin dependency in your theme.
<?php if( function_exists( 'bellows' ) ): ?> <?php bellows( 'main', array( 'menu' => 26 ) ); ?> <?php endif; ?>
Bellows Menu Generator UI [Pro]
Pro users can also make use of the Bellows Menu Generator UI to preview their menus and generate code for standard menus as well as Auto-Populated menus.