Found a ‘dirty’ way to do it:
Here’s my code:
$sidebar_id = 'sidebar1';
$sidebars_widgets = wp_get_sidebars_widgets();
$widget_ids = $sidebars_widgets[$sidebar_id];
foreach( $widget_ids as $id ) {
$wdgtvar="widget_"._get_widget_id_base( $id );
$idvar = _get_widget_id_base( $id );
$instance = get_option( $wdgtvar );
$idbs = str_replace( $idvar.'-', '', $id );
echo '<li><a href="#'.$id.'">'.$instance[$idbs]['title'].'</a></li>';
}
Related Posts:
- Limit number of Widgets in Sidebars
- check if registered sidebar is active & has widget content
- How to use wp_dequeue_style() for style enqueued in WP_Widget class
- $post>ID displays wrong post ID
- Programmatically edit the text of a widget
- Video Embed in Sidebar Widget with Links to Others in Category
- Shortcode from a widget is wrapped in unwanted element
- Bookshelf plugin and/or widget [closed]
- How to update widget from widget() function?
- Add a banner to the Dashboard
- Is there a way to allow only certain type of widgets in the sidebars?
- Shortcode in Text Widget not working
- Trigger Submit Event when Widget is added to Sidebar
- Ask user permission when activating a plugin
- Why wordpress popular post widget shows Undefined index?
- How to enable / use new video / audio / images widgets in WordPress 4.8?
- How do i export the HTML from text widgets?
- Latest/Recent posts widget title link
- the_widget() and widget’s ID
- Insert Widget option into mark-up with register_sidebar
- Widgets not expanding on wordpress 3.3 widget dashbord
- How to put Stack Exchange Flair as widget?
- Removing default theme widgets
- Image Upload Widget Issue
- Wp Customizer event for when a new widget has been added
- wp_register_sidebar_widget() disappered my Widgets submenu – what am I doing wrong?
- Display single widget
- Adding widgets with Featured Image via the Customizer run hundreds of queries
- How to list all custom post types in a custom widget?
- How can I assign widgets from WP to appear in bbpress?
- get_option returns undesired blank instance of a widget
- escaping and sanitizing input for custom widget form fields
- Drafts widget for admin page
- Global $wpdb is not showing correct data with function call
- Dynamic created widget id value of multi-instance in jQuery
- Text widget doesn’t save the content
- Post ID displayed instead of title [closed]
- Color picker in widget appears twice when added via the Customizer
- How to select multiple media files for a widget form?
- Create an extra Widget Areas in WordPress TwentyTwelve
- How do I pass the id of my widget to javascript in the form function?
- Widget – link to page rather than absolute url
- Apply code for all else first block
- How i can widget ID get after drag for wordpress with jquery?
- Programmatically add widgets to sidebars
- Validating widget’s configuration data on Admin page
- Turn off “This is the Primary Sidebar Widget Area” message
- Inserting Read More Tag in Widget
- Adding a WordPress Widget to a settings page
- Display posts from category in post content?
- How to change “Call To +1800090098” in TopStore pro theme [closed]
- How to dynamically add the the input text field in widget?
- Header Sidebar Won’t Move Lower – Want to Align with Header Logo [closed]
- Is there a way to use get_sidebar() when no widgets are activated?
- Is there any tab widget plugin supporting third party widgets? [closed]
- Add footer widgets
- Widgets in WP 4.3 disappearing – How to fix?
- Making jQuery .change() event persistent after widget save
- Widget background images missing on second blog excerpt page
- Custom CSS for a particular text/html widget in WordPress
- Removing side bar widgets from GovPress theme
- Adding a single text input field to a custom Dashboard widget
- how to show only particular category post in archive widgets
- How to test if the widgetized area has any widgets?
- Saving widget gets an undefined variable
- Distinguish between different widgets of the same type
- links to Media Library content in sidebar per page
- Why is registering a sidebar for each page causing my sidebars to reset?
- Limit archive widget results
- How can I detemine the parameters needed by the_widget()?
- widgets in footer?
- Can you hide a widget based on its content?
- Quick Draft widget in weird place on dashboard after being re-added
- Fatal error: Uncaught Error: Class ‘WP_Widget’ not found
- Array showing all values of loop instead of specific value to post
- How can I remove WordPress element IDs and Class names in the HTML?
- Remove widgets on mobile front page without affecting desktop
- Widget not appearing in customizer
- Widget display nothing
- Widget settings disappear after refresh
- How to display author meta in a sidebar widget
- Is it ok not to set widget in the main page of a one page WordPress Theme?
- Recent Posts Widget URL / Domain change
- New Custom Widget Call a Different Widget Function
- Make a widget to my footer
- How to change text of a widget depend on condition?
- Display Posts by Views (Popular Posts Widget)
- Default WordPress widgets always appear
- Add space to the end on a widget
- Show editor widgets only on pages that use a specific template?
- Options page for widget
- user definable sidebar per page
- List.js inside WordPress widget
- Show or hide custom menu widget in side bar conditionally
- Custom tabs widget don’t work in google chrome, is blocked, do not change the tabs. Why?
- Post Thumbnails on Sidebar Widgets
- Widget which displays thumbnails, but links to urls?
- Using Conditional Tags to restrict something to 1 user?
- Problem on register/login widgets
- Custom dashboard widget – load style only for added widget