How to display custom sidebar in wordpress 5.5.2
How to display custom sidebar in wordpress 5.5.2
How to display custom sidebar in wordpress 5.5.2
I would consider the following … Register a new sidebar: function your_new_widget() { register_sidebar( array( ‘name’ => __( ‘Single View Sidebar’, ‘your_textdomain’ ), ‘id’ => ‘sidebar-single’, ‘description’ => __( ‘This widget area is found only on the single post view.’, ‘your_textdomain’ ), ) ); } add_action( ‘widgets_init’, ‘your_new_widget’ ); Create a new sidebar template: /** … Read more
http://codex.wordpress.org/Function_Reference/get_sidebar <?php get_sidebar(‘other’); ?> for instance will call the template sidebar-other.php you would add the dynamic_sidebar() code in that sidebar-other.php template; see also http://codex.wordpress.org/Widgetizing_Themes
In order to accomplish this you will need to also create a separate page template to use. You may need to double check your template head information. Example: <?php /* * Template Name: Your Template name */ ?> This has to be put at the top of the page template. Then within the custom page … Read more
You’ve changed from sidebar-main in your myfunc_sidebars_init() to sidebar1 in sidebar.php. Change sidebar.php to use <?php if ( is_active_sidebar( ‘sidebar-main’ ) ) : ?> <?php dynamic_sidebar( ‘sidebar-main’ ); ?>
WordPress widgets are context dependent, that means if any templates use the dynamic_sidebar() function or in other words has any sidebar or widget area in that template then you’ll see widgets in the customizer. For instance, if page.php has sidebar then when you’re in a page you’ll see widgets in the customizer.
There’s nothing wrong with registering a sidebar via plugin. You do it the same way as registering via theme: add_action( ‘widgets_init’, function() { register_sidebar([ ‘name’ => ‘Your Sidebar’, ‘id’ => ‘your-sidebar’, ] ); } );
The after_title does not go through any transformations. In fact only the before_widget does: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/widgets.php#L876 However, a little lower you can see that $params = apply_filters( ‘dynamic_sidebar_params’, $params ); there’s a filter you can hook to do your own filtering. add_filter( ‘dynamic_sidebar_params’, ‘wpse_45418_change_after_title’ ); function wpse_45418_change_after_title( $params ) { $id = $params[0][‘widget_id’]; if ( $id … Read more
There are some problems in your code but you are close, some pointers to solve problems. First, eliminate as much code as you can which still contains the problem. In your case remove the second widget, the less code you have to look at the easier it will be to find the problem. In other … Read more
Here is what worked: add_action( ‘after_setup_theme’, ‘parent_override’ ); function parent_override() { unregister_sidebar(‘sidebar-4’); /** I have looked for the ID of the sidebar by looking at * the source code in the admin.. and saw the widget’s id=”sidebar-4″ */ register_sidebar(array( ‘name’ => ‘Footer’, ‘before_widget’ => ‘<div class=”span3″>’, ‘after_widget’ => ‘</div>’, ‘before_title’ => ‘<h6 class=”footer-widgets-item”>’, ‘after_title’ => … Read more