Found a solution to the problem. I added a line of code id => ‘my-sidebar-id’ to the register_sidebar array so now i know the sidebar ID. There may be another way of doing it but this method seems to work fine for me now anyway.
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name' => 'Right Sidebar',
'id' => 'right-sidebar',
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '</li>',
'before_title' => '<h4>',
'after_title' => '</h4>',
));
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?
- register_sidebar ignores ‘id’ and ‘class’
- 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
- How to add multiple custom widget areas
- Best practices: Custom theme sidebar menu – hardcode or widget?
- Register sidebar ‘before’ and ‘after’ html as div rather than li tags
- Undefined index: custom_sidebars
- Create new sidebars trough admin post/page metabox
- How to create multiple sidebar areas with a forloop and register_sidebars?
- What is the difference between front-page.php and home.php? [duplicate]
- How important is it to enqueue a theme’s stylesheet?
- Can a theme be built in React?
- Strict Standards Error bootstrap navwalker
- Specify image dimensions
- Adding Action Hooks In Parent Theme For Easier Child Theme Customization
- Add colors to existing color palette without replacing it
- Single Page WordPress Theme – Using page templates
- Add link option to featured image?
- Creating the modern ‘single page’ html5 css3 layout in wordpress
- esc_url not working within add_settings_field callback
- How to hide and content from auto-generated excerpts?
- How to override BuddyPress 3.0 bp-nouveau theme files?
- Which theme foundry has clean coded themes, where code is poetry [closed]
- How WordPress converts URL to $query_string
- More than one meta field in a single meta box?
- how can I remove the sidebar from my wp homepage [closed]
- How to develop child theme for thesis
- 2 differen’t menus and it’s using same items in both
- “add_theme_support” for custom footer color?
- Why is the post type on the search result page random?
- Highlight “Show all” item in wp_list_categories
- get_option in header.php not returning value from customizer
- What happens to child theme if I change to new version of parent theme?
- Internal error 500 accessing Theme > Customize
- Save Widget State Between Theme Swaps?
- Theme Development: Starter Content after hook
- Display theme layouts [closed]
- How do i place same widgets multiple time by default on theme activation?
- Getting php_network_getaddress error : No such host is known?
- HTML added to editor when deleting shortcodes in Chrome browser
- Combining CSS files into a single cached one
- How to set a page as homepage in stead of the newspages?
- WordPress Theme Validator?
- Get the amount of posts on a given page
- How do I use a color from theme options?
- Is there any way to register custom background images like header images?
- How to make javascript work on theme options page
- Second menu has the first menu ID
- How to include a file only on dashboard widgets page?
- What exactly is “wordpress theming”? [closed]
- Present Color Schemes to Clients
- WP_Query $gallerypage->the_post() giving Undefined offset: 0
- Change Image Sizes for Mobile Theme
- Dynamically Populating Image/Excerpt/LInks from Pages in WordPress
- Trouble in creating a custom template on twentyeleven theme
- language support in a custom urdu theme
- If I remove Category base from my URLs, how difficult will rollback be?
- Is there a list of default generated Gutenberg block CSS? Unable to align video blocks
- In wordpress customizer div still showing even if I hid it with javascript
- How do I change the color of individual page titles in WordPress?
- Programatically Created Menu not Editable in Dashboard
- How toprint informations in footer
- How to implement pagination in category.php template
- Embedding CodePen Calorie Script – jquery error
- Is it possible to echo a woocommerce prouct attribute discription?
- WordPress Menu item > Sub menu Class update
- Duplicate child theme incl. design changes
- Why .widget-area is outside of .site-content in Underscores starter theme?
- How can I use a different template file for the blog index’s paginated pages?
- How to customize the colors within a stylesheet using a WordPress setting
- Dynamic sidebar areas not working on the Theme Customizer
- On wordpress, how do i require specific dimensions from user uploads only
- how to create export / import theme options in wordpress without plugin
- WordPress Customization API overwrite LESS variable
- Modify comments_popup_link output
- Create image with imagepng() (fails at header)
- Can you create a custom page with content in the center already defined?
- Dynamic meta description
- How to Remove Sidebar when get_sidebar() is not get called in page?
- RSS feed url showing page not found. How to solve it?
- Plugin or script to apply updated media settings to all featured images
- Header links also appearing in the footer
- Extending arrays in parent theme without completely overriding the files
- Retina ready for uploaded images which are cropped
- WordPress Subpages Fancybox Trouble
- Toolbox theme using printif statement – help needed understanding code block
- Search Results not displaying for multiple word search
- Allow users to edit home page from WordPress (home.php problems)
- WordPress does not know the parametrs i sent to admin post
- Display Page featured Image as well as Posts featured Image
- Custom Single Page Portfolio Theme [closed]
- How to make a multilingual wordpress site to be translated one-to-one without much effort and without using translate?
- Is there a way to have WordPress autodetect page templates in the page-templates directory and any sub-folders?
- Theme template file for a specific custom taxonomy
- How do I work with responsive images in WordPress? (img srcset/sizes)
- How can I use pre declared blocks in a php file?
- jQuery Snippet Not Working on WordPress Site [closed]