When you register your sidebar, you can change how it handles those things with the before_title
, after_title
, before_widget
, and after_widget
arguments. For example:
register_sidebar(array(
'before_widget' => '',
'before_title' => '<h3>',
'after_title' => "</h3>\n<div>",
'after_widget' => '</div>'
));
Would make all of the widgets in that sidebar have that structure. You could also add classes to the tags defined there (<h3 class="accordion-toggle">
, </h3>\n<div class="accordion-content">
). Just make sure all your widgets have a title; otherwise the widget will cause some tag imbalance.
Related Posts:
- HowTo: Add Class to Sidebar Widget List-Items
- How to wrap the widget content with a div or get the widget title outside?
- Add class to before_widget for all widgets with a dropdown and a counter
- How to get the name and description of a sidebar in theme?
- Registering Sidebars and Sidebar Widgets. Sidebar Widgets Not Displaying
- How the WordPress sidebar works
- Can not Remove Archives and Meta from Sidebar
- How to allow admins to create a sidebar from the admin
- How do I display the “Archives” widget layout (sidebar) in WordPress by ‘year’ then by ‘months’?
- Best practices: Custom theme sidebar menu – hardcode or widget?
- how can I remove the sidebar from my wp homepage [closed]
- Toggle Sidebar Display
- searchform.php override not working
- Displaying details of a post in a sidebar
- “Theme without sidebar.php is deprecated”
- Load sidebar template just once to prevent multiple animations
- How is the `get_sidebar` function meant to be used to call a 2nd sidebar?
- Should I create multiple sidebars, or use or one dynamic sidebar with logic to determine it’s abilities?
- How can I hard code my sidebar?
- Should is_active_sidebar() always be used around dynamic_sidebar()?
- Load different single.php templates according to post layout selection
- A post with a clear:both in its css destroy the theme design, and the sidebar is moved to the bottom
- How to add sidebar to Isola theme? [closed]
- Allow different tags in widget titles
- Change the sidebar from left to right twentyfourteen theme
- Changing sidebar.php and footer.php depending on URL
- Recommended sidebar / content widths
- Hide/disable sidebar using shortcode?
- Sidebar not displaying (theme development)
- Cold Fusion to WordPress
- Display problems in admin dashboard when creating a new theme from scratch
- Undefined index: custom_sidebars
- Best strategy for providing theme options using customizer
- Creating a Playlist of Widgets
- How to display only some widgets of a sidebar?
- How to Remove Sidebar when get_sidebar() is not get called in page?
- WordPress two sidebar layout or theme
- Conditional tags issue for multiple is_page() conditions in sidebar.php
- Incorrect sidebar showing on WooCommerce Store page [closed]
- Replacing static code in a template file with a sidebar and widgets?
- Is there a has_more_tag() method or equivalent?
- How to force Media manager to overwrite files of same name?
- How wp_cache is supposed to work, and does it help with performance?
- is_home() returns false on the home page! When is the home page NOT the home page?
- Enabling Widgets By Default in Custom Theme Development
- How to fix the error “file_get_contents was found in the file functions.php”?
- Identifying the priority of style.css so I can make a small CSS file load last
- WordPress Customize — Move “menus” options / field to another section
- How to use the responsive images feature from WP 4.4 in your themes
- What are WooCommerce starter themes? [closed]
- How to support Lazy Loading Assets in a WordPress Theme?
- Convert PHP readfile to WP_Filesystem
- Wysiwyg editor for P2 theme
- Sub folder CSS that’s read by Admin panel
- Dequeue a style file which is making website load slow!
- How to customize save function event?
- WordPress page templates in a directory
- Do I need normalize.css when developing my own WordPress-theme?
- Limit Loop to 5 Posts?
- Table of Contents Before first heading
- Theme-wide custom post template
- comment form args are not translatable (customized comment form)
- Zoom on custom theme without child
- What do with the index.php … [duplicate]
- How to add Space between sidebar and footer widget in WordPress theme [closed]
- Custom Navigation build using wp_nav_menu and walker
- Question regarding WP multisite feature
- Call to undefined function add_menu_page() on theme activation
- Is it acceptable for a WordPress theme to not accept widgets?
- Should all references to a text domain be to my current theme?
- Simple child theme modification but links are broken
- Is functions.php in themes applied to all templates?
- Doing context-aware previews in the WordPress Customizer
- First post full width without Sidebar
- best practices for updating wordpress theme
- Multi Site Setup, Child Themes, Getting Style Sheet Directory
- Add class every 4 post like , class_1, class_2, class_3, class_4 and class_1, class_2, class_3, class_4
- Theme functions don’t work as expected in partial included via get_template_part() after custom query using Ajax [duplicate]
- Avoiding do_shortcode() loops
- WordPress Post Order
- Why content is not adding for each blog post
- Correct was to customise theme using get_theme_mod in scripts
- Recent post in the middle of the content
- How to figure out which wordpress theme a site was using?
- Best way to allow for extended use of WordPress functions inside single.php
- Flexslider not working for my custom theme WordPress
- How to close open divs in post loop
- Workflow of Collaboration on wordpress development [closed]
- How to make admin theme option with image slide show?
- Explanation of User Roles and Capabilities
- Creating image grid on products page in wordpress
- Insert gutenberg blocks into template
- Bootstrap 4 mobile menu not working for WordPress Development
- Configuring static page with add_rewrite_rule gives 404 after navigating to Permalinks admin panel
- How to Enable Hot Module Replacement with Webpack
- What is the point of using archive.php instead of index.php?
- How to make it so I can “use” template parts in (classic/full) site editor
- How do I send out an update for my custom wordpress theme?
- custom wordpress theme blog page always not showing the last two pages of the articles
- Cart button not working on mobile version [closed]