How Can I Replicate & Register a Widget from the Child Theme
How Can I Replicate & Register a Widget from the Child Theme
How Can I Replicate & Register a Widget from the Child Theme
Creating new query objects is not a good idea in this situation. Try simply getting the pages and using those objects to serve up the widget areas: add_action( ‘widgets_init’, ‘my_243057_widgets_init’ ); function my_243057_widgets_init() { /** * Get only published page objects * @link: https://codex.wordpress.org/Function_Reference/get_pages */ $pages = get_pages(); foreach ( $pages as $page ) { … Read more
In your sidebar.php or any other custom sidebar file call by ID like this <?php get_sidebar(‘sidebar-widget-1’); ?> Not like this <?php get_sidebar(‘Sidebar Widget 1’); ?> See the difference, I used ID in get_sidebar() function instead of name. Now where ever you want sidebar appear in front-end, there call it like this <?php get_sidebar(‘sidebar-widget-1’); ?>
Make sure you have called a right hook to register your widgets. You may call your widget through dynamic_sidebar function. Please see full description.
Technically “off topic” here as your actual question is open-ended and there is lots of room for opinion. https://wordpress.stackexchange.com/help/dont-ask Sidebars and widgets are a perfect way to organize these elements. Keep in mind these are simply tools to organize blocks for repeated use in various locations. So, officially, my answers to your two questions are: … Read more
Siderbar implementation with collapsible bootstrap cards
You would do something like this with your CSS. Setting a fixed height and whatnot is only for example purposes: #content { background: brown; width: 75%; height: 500px; float: left; } #sidebar { background: gray; width: 25%; height: 500px; float: left; } <div id=”content”></div> <div id=”sidebar”></div>
In the end, I’ve managed to do in this way (function( plugins, editPost, element, components, data, compose ) { const el = element.createElement; const { Fragment } = element; const { registerPlugin } = plugins; const { PluginSidebar, PluginSidebarMoreMenuItem } = editPost; const { PanelBody, ColorPicker } = components; const { withSelect, withDispatch } = … Read more
OK, I used just normal function and it’s ok. function twentytwentychild_widgets_init() { register_sidebar( array( ‘name’ => __( ‘Widget name’, ‘twentytwentychild’ ), ‘id’ => ‘after-post’, ‘description’ => __( ‘Widget desc.’, ‘twentytwentychild’ ), ‘before_widget’ => ”, ‘after_widget’ => ”, ‘before_title’ => ”, ‘after_title’ => ”, ) ); } add_action( ‘widgets_init’, ‘twentytwentychild_widgets_init’ );
What you’ll have to do is look at your HTML both before and after adding the widget. Whatever stylesheet (link) appears and disappears is the stylesheet that is giving you the problem. Search the CSS for the .section-heading selector and you will have found your culprit.