You've already forked wp-bootstrap
v1.0.0 - Release: widget area, documentation refresh
- Register sidebar widget area via register_sidebar() - Render WordPress widgets in Twig sidebar with fallback to built-in content - Update README.md with accurate feature counts and descriptions - Update translation files with widget area strings - Bump version to 1.0.0 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -387,12 +387,26 @@ class ContextBuilder
|
||||
|
||||
/**
|
||||
* Get sidebar widget data.
|
||||
*
|
||||
* If the 'primary-sidebar' widget area has widgets assigned,
|
||||
* their rendered HTML is returned. Otherwise, fallback data
|
||||
* (recent posts, tags) is provided for the default Twig sidebar.
|
||||
*/
|
||||
private function getSidebarData(): array
|
||||
{
|
||||
$widgets_active = is_active_sidebar( 'primary-sidebar' );
|
||||
$widgets_html = '';
|
||||
if ( $widgets_active ) {
|
||||
ob_start();
|
||||
dynamic_sidebar( 'primary-sidebar' );
|
||||
$widgets_html = ob_get_clean();
|
||||
}
|
||||
|
||||
return [
|
||||
'recent_posts' => $this->getSidebarRecentPosts(),
|
||||
'tags' => $this->getSidebarTags(),
|
||||
'widgets_active' => $widgets_active,
|
||||
'widgets_html' => $widgets_html,
|
||||
'recent_posts' => $this->getSidebarRecentPosts(),
|
||||
'tags' => $this->getSidebarTags(),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user