Try this in your functions.php
function your_widget(){
register_sidebar(array(
'name' => 'Footer Column 2',
'id' => 'footer-column-2', // I also added the ID but doesn't work
'before_widget' => '<div id="%1$s" class="omc-footer-widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4>',
'after_title' => '</h4>'
));
}
add_action( 'widgets_init', 'your_widget' );
Call in footer.php with the ID.
<?php if ( is_active_sidebar( 'footer-column-2' ) ) : ?>
<div class="omc-footer-widget-column">
<?php dynamic_sidebar( 'footer-column-2' ); ?>
</div><!--- /second-footer-column -->
<?php endif; ?>
Related Posts:
- What is allowed as an id argument in register_sidebar( $args )
- register_sidebar notice [closed]
- register_sidebar function problem
- Registering Sidebar. Additional banners got displayed
- register_sidebar / dynamic_sidebar with sidebar id
- Get list of all registered sidebars
- List all sidebar names?
- Text Widget creates a
- HowTo: Add Class to Sidebar Widget List-Items
- How to wrap the widget content with a div or get the widget title outside?
- Get sidebar parameters (before_widget, before_title, etc.) from within a widget
- How to register_sidebar() without messing up the order?
- register_sidebar ignores ‘id’ and ‘class’
- dynamic_sidebar not rendering sidebar
- Get custom side bar on custom post archive page
- Add div class to only one widget
- How to get the name and description of a sidebar in theme?
- What is the use case for the “Class” parameter in register_sidebar?
- How to avoid widgets added to sidebar on theme activation?
- WP available widget for certain area
- Registering Sidebars and Sidebar Widgets. Sidebar Widgets Not Displaying
- Hooking Into Widget Output Loop
- Plugin Sidebar is not Saving Meta Attribute to Post/Page after “Update”
- How the WordPress sidebar works
- Custom sidebar not showing in the dashboard
- Why do none of my widgets have a title?
- Sidebar Generator? :)
- Widget area inside a widget
- How to add multiple custom widget areas
- how do I get a sidebar’s id or number for use with is_active_sidebar()
- Registering multiple sidebars with data from an array
- Best practices: Custom theme sidebar menu – hardcode or widget?
- More flexible sidebar and widget management
- WordPress widget new instance creates content duplicates
- duplicate sidebar
- Removing custom widget area WordPress 4.4 [closed]
- Insert Widget option into mark-up with register_sidebar
- Widgets not expanding on wordpress 3.3 widget dashbord
- What are ideal hooks to call register_sidebars?
- Add before_content and after_content to register_sidebar
- I can’t get my custom widget area to show on my WordPress site
- How can you add a link to a sidebar description?
- Cannot save widgets in custom sidebars
- unregister_sidebar() in stand-alone theme not working
- WordPress widget/sidebar dividers?
- adding multiple sidebars on pages
- How do I override a sidebar that is registered in a parent theme when using a child theme?
- wp_register_sidebar_widget() disappered my Widgets submenu – what am I doing wrong?
- Toggle option in sidebar widgets
- Register a sidebar in a WordPress plugin
- Can’t see widget areas in my customizer
- Widgets not activated alert after using get_sidebar()
- Custom page sidebar using Template dropdown box
- Register/Get sidebar?
- Creating a different side bar for single posts than for main page.
- How to display custom sidebar in wordpress 5.5.2
- Can you target a widget_class in a register_sidebar?
- Adding Multiple Sidebars
- Displaying Custom Sidebar Without Modifying Theme’s Core File?
- How to increase maximum number of sidebars support?
- Copy Widget Settings because of changed IDs
- How to enable the default sidebar area?
- 2 dynamic sidebars registered, not showing up
- Custom Sidebar only on single post
- Add #sidebar-2 to a custom page template
- Sidebar widget not displaying after simple code update.
- Register sidebar ‘before’ and ‘after’ html as div rather than li tags
- Dynamic sidebar rendered in another place than i would like
- Sidebar not appearing in footer, but it appears everywhere else!
- How to pass a special CSS class into widget li
- Widget title markup in register_sidebar
- Dynamic Sidebar Conditional [duplicate]
- finding sidebar content in wordpress
- Add SideBar/Widgets Just Below the Post
- Add class to on sidebar widget
- Save button is not working on custom widget
- Register_Sidebar overwriting itself and doesn’t exist in global $wp_registered_sidebars;
- How can i display custom menu in sidebar?
- Adding an extra sidebar to your theme
- Sidebar only shows up on blog page
- widgets not working
- Why the dynamic_sidebar() call is putted into an ul tag?
- Is there a way to dump all registered sidebar/widget?
- Sidebar widgets – dynamic CSS : problem with widget-title
- How to troubleshoot Sidebar not being generated
- How to customize wordpress sidebar widget
- Why is registering a sidebar for each page causing my sidebars to reset?
- activate custom sidebar widgets
- Why is my custom sidebar always open on the widgets screen in Admin?
- Custom sidebars – get_sidebar() problems
- Content not showing up when using custom template + sidebar
- Displaying registered sidebar after post content
- How to use register_sidebar’s ‘before_widget’ unique id generator into its other parameters like ‘before_title’?
- After adding widget the style is messing up
- Widget is displayed in two places
- Get or set values in post meta
- How to make sidebar float right and site content left
- Siderbar implementation with collapsible bootstrap cards
- How to create sidebar from “scratch”?
- My widgets do not save