Questions tagged [register-sidebar]
Registers a single sidebar and returns the ID. Call on "widgets_init" action.
122
questions
0
votes
0
answers
14
views
is it possible to create custom widgets page in admin?
I am currently programming a WordPress theme
And I'm thinking of adding ads control places in the widgets (using register_sidebar, but at the moment the widgets appear in one place without ...
0
votes
1
answer
241
views
Why do none of my widgets have a title?
I've never seen this issue before, so it could either be a mistake on my part, or a very recent change to WP core, but either way it doesn't make sense for me.
Like usual, I register widgets like I ...
0
votes
1
answer
211
views
How to use register_sidebar's 'before_widget' unique id generator into its other parameters like 'before_title'?
I'm trying to create a dynamic sidebar that uses bootstrap 4 accordion with the widget's title as the toggle link and the widget content as the accordion's content:
Planned Layout:
<div class="...
1
vote
2
answers
62
views
Register a sidebar in a Wordpress plugin
We have developed a Wordpress plugin to create a reservation engine. We use a shortcode to build the checkout process. This shortcode creates html. We would like to define a sidebar in this generated ...
1
vote
0
answers
17
views
How to display custom sidebar in wordpress 5.5.2
I am trying to display a custom sidebar in worpress 5.5.2 latest version but i have registered one sidebar in functions.php and in sidebar i want to display it so i put code to display in sidebar.php
...
0
votes
1
answer
76
views
After adding widget the style is messing up
I add a widget area to a wordpress theme but the style is somehow not matching with html
here is the image
before adding widget
after adding widget
widget area
functions.php
<?php
//Adding the ...
0
votes
1
answer
13
views
Widget is displayed in two places
I want to add a widget below page content in my child theme. I used a function from here: https://codex.wordpress.org/Widgetizing_Themes and the widget is displayed where I want:
but it is also ...
0
votes
1
answer
199
views
Get or set values in post meta
I've built this theme option, based on the following tutorial https://rudrastyh.com/gutenberg/plugin-sidebars.html#registerPlugin
but now I'm having trouble figuring out how to send the post/page ...
0
votes
1
answer
771
views
How to make sidebar float right and site content left
am trying to develop my own wordpress custom,am having problems trying to add a sidebar float left e.g something like Twenty Sixteen theme.
please help am still learning.
Thank you.
0
votes
2
answers
251
views
Dynamic sidebar rendered in another place than i would like
I'm trying include dynamic sidebar to Uncode Theme. I created child template, then I created all files and now I have a piece of code who shows content and sidebar area.
In functions.php I created ...
0
votes
1
answer
2k
views
Add class to <ul> on sidebar widget
I have been looking on stack overflow and the web but can't find a simple solution for this.
I just want to add a class to the of the widget sidebar generated by Wordpress.
This is my register ...
0
votes
1
answer
1k
views
Save button is not working on custom widget
I created a custom widget according to Widget API and it seems to work until I make changes. The save button is not triggered, this problem is only affecting this new widget.
Ps. The custom widget ...
0
votes
1
answer
1k
views
Plugin Sidebar is not Saving Meta Attribute to Post/Page after "Update"
I have modified the tutorial at https://wordpress.org/gutenberg/handbook/designers-developers/developers/tutorials/plugin-sidebar-0/ to meet ES6+ but I am having trouble getting it to actually save to ...
2
votes
1
answer
3k
views
How to add multiple custom widget areas
I'm looking to add multiple widget areas to a page in my theme as id like to have widgets within certain pages. I can add one using this code, I'm just struggling with a second.
function ...
0
votes
0
answers
167
views
Siderbar implementation with collapsible bootstrap cards
I'm trying to implement collapsible Bootstrap 4 cards on sidebar widgets, until now I have this:
register_sidebar(
array(
'name' => esc_html__( 'New Sidebar', 'ns' ),
...
3
votes
1
answer
156
views
How to avoid widgets added to sidebar on theme activation?
I am registering 3 sidebars on widgets_init
register_sidebar(array(
'name' => esc_html__('Left Sidebar','creatus'),
'id' => 'left',
'before_widget' => '<div ...
0
votes
1
answer
3k
views
How to enable the default sidebar area?
I have a theme created from scratch.I am able to create custom sidebar area and add widgets to it.
But when i give this in index.php
<?php get_sidebar(); ?>
it shows some widgets rendered in ...
1
vote
2
answers
2k
views
register_sidebar function problem
What's wrong in this function?
function init(){
//go through each sidebar and register it
$sidebars = sidebar_generator::get_sidebars();
if(is_array($sidebars)){
foreach($...
1
vote
1
answer
11k
views
Can't see widget areas in my customizer
I've registered 7 Sidebars in my template, I can see them correctly in the Apparence > Widget panel and my front-end, but I can't see them in the Theme Customize, when I click on my Widget section I ...
2
votes
1
answer
323
views
Wordpress widget new instance creates content duplicates
I have a custom made widget that I wrote and I want to display two instances of the same widget in the same widget area. When I drag and drop new widget instance to the widget area inside admin panel ...
0
votes
1
answer
52
views
How to create sidebar from "scratch"?
I want to create a section on my website which will contain information about different locations, this section has tabs width different information:
My idea was to register a sidebar and then use a ...
0
votes
1
answer
482
views
My widgets do not save
Every time when I save my widgets and navigate away from the page, my widgets are gone. The sidebar is completely emptied and no change will be saved.
I don't get any errors in the console or PHP log....
0
votes
1
answer
228
views
Sidebar not appearing in footer, but it appears everywhere else!
Problem
My sidebar is not displaying in the Wordpress footer.php file.
functions.php
<?php
add_action( 'widgets_init', 'social_media_sidebar' );
function social_media_sidebar() {
...
3
votes
1
answer
2k
views
How to get the name and description of a sidebar in theme?
I have a sidebar registered (in functions.php) as:
<?php
register_sidebar( array(
'name' => __('Activity Calendar'),
'id' => 'activity_calendar_en',
...
3
votes
2
answers
3k
views
Add div class to only one widget
I want to add more classes in the div tag of my search widget. My search is located in the sidebar together with other widgets.
My code:
function NT_widgets_init() {
register_sidebar( array(
'...
0
votes
2
answers
3k
views
How to get sidebar widgets in leftsidebar template
I have created a custom sidebar widgets using below code :
register_sidebar(array(
'id' => 'sidebar-widget-1',
'name' => 'Sidebar Widget 1',
'before_widget' => '',
...
0
votes
1
answer
174
views
Register_Sidebar overwriting itself and doesn't exist in global $wp_registered_sidebars;
I have Dynamic sidebars that are generated based on terms of a taxonomy that were created.
CLASS EXCERPT:
public function __construct() {
add_action('widgets_init', array($this, '...
0
votes
1
answer
224
views
Dynamic sidebar areas not working on the Theme Customizer
I am trying to create one sidebar area per page in a WordPress site. For example, if a WordPress installation has 2 pages: 'Home' and 'Blog', then there'll be two sidebar areas, 'Home sidebar area' ...
0
votes
0
answers
150
views
How Can I Replicate & Register a Widget from the Child Theme
I'm working with a WordPress theme which features a widget that uses the Google Maps API to display a map in the footer of the site. It works great, but seeing that we have two buildings, I would ...
3
votes
2
answers
10k
views
register_sidebar notice [closed]
I have updated my site manually, now I get below mentioned notice in the front and backend:
Notice: register_sidebar was called incorrectly. No id was set in the
arguments array for the "Main ...
1
vote
1
answer
2k
views
I can't get my custom widget area to show on my Wordpress site
I can't get my sidebar to appear on my site.
I add a widget section since there wasn't any:
function.php
<?php
if (function_exists('register_sidebar'))
// Area 1
register_sidebar( array (
...
0
votes
1
answer
140
views
Wordpress Bootstrap Grid
What's the best way to create a grid layout using bootstrap, or see link below http://v4-alpha.getbootstrap.com/examples/carousel/ displaying three different headings, should i use wp-query or, ...
3
votes
1
answer
430
views
WP available widget for certain area
After searching under the tag widget and Google the closest I have found that populates what I am looking for is this article:
Is there a way to allow only certain type of widgets in the sidebars?
I ...
2
votes
0
answers
941
views
Removing custom widget area WordPress 4.4 [closed]
I know it is a very simple thing but I just cannot figure it out.
I always used to define widget areas and sidebar in source code, however this time I have used the UI option from Appearance > ...
0
votes
1
answer
431
views
Undefined index: custom_sidebars
I am implementing custom sidebars on a theme I am developing.
Everything works fine when I add new custom sidebars. However, when if I remove these new added custom sidebars I get the error Undefined ...
0
votes
0
answers
79
views
Create new sidebars trough admin post/page metabox
I have this bit to register sidebars dynamically:
function my_custom_sidebars() {
$sidebars = get_option('my_theme_sidebars'); // get all the sidebars names
if ( ! empty($sidebars) ) {
// add a ...
1
vote
0
answers
95
views
Can you target a widget_class in a register_sidebar?
Using Bootstrap 3 to create a WordPress theme I am using register_sidebar() for the sidebar:
if ( function_exists( 'register_sidebar' ) ) {
register_sidebar( array(
'name' => __( '...
0
votes
2
answers
2k
views
Add the title of a widget as an ID - for anchor links
I'm currently building a WordPress theme where my page consists of widgets. One widget is a part of the page. I'd like to be able to use anchor links with them, and to do this, I would like to output ...
8
votes
3
answers
7k
views
Text Widget creates a <li>
I've got a basic text widget and, outside the standard <div class="textwidget"> wrapper there is a <li id="text-5" class="widget widget_text"> (which I have not added when creating the ...
0
votes
1
answer
840
views
How can i display custom menu in sidebar?
I would like to display a custom menu in a custom sidebar instead of author information or blank space i.e custom menu with similar styles as default menu but only in vertical manner as displayed in ...
4
votes
1
answer
3k
views
Get custom side bar on custom post archive page
I have a custom post type called “bibliographies” and the corresponding archive-bibliographies.php file to show a list of posts. On this page I want to add a side bar that is unique to this page, so I ...
0
votes
2
answers
934
views
Adding an extra sidebar to your theme
I want an extra sidebar added to this wordpress theme of mine. I want it right under my left sidebar and not next to it as it is currently showing: www.giftforgag.com.
I have tried many things but ...
0
votes
1
answer
550
views
Sidebar only shows up on blog page
I am currently working on a theme that uses a Page Sidebar for the Contact, About, Portfolio and Home pages, and a Blog Sidebar for the Blog page.
For some reason, the Page Sidebar is not showing up ...
2
votes
1
answer
88
views
Registering multiple sidebars with data from an array
I am attempting to dynamically register sidebars for certain pages. The pages must meet the following criteria:
be published
be a page (not a post)
use the template 'template-generic-sidebar'
In my ...
0
votes
3
answers
2k
views
register_sidebar / dynamic_sidebar with sidebar id
I am trying to get rid of the following error in debug:
Notice: register_sidebar was called <strong>incorrectly</strong>.
No <code>id</code> was set in the arguments array ...
1
vote
3
answers
657
views
How the WordPress sidebar works
Ok, the title is surely not good to explain my very basic question, but here it is:
I just started creating a wordpress theme and the index.php has two columns:
1.) The main content and
2.) A ...
1
vote
1
answer
178
views
How can you add a link to a sidebar description?
How can I add a link to a sidebar description?
$sidebar_description = sprintf(__( 'Sidebar for the <a href="%s">%s</a> post', 'themetext' ), get_permalink($post->ID), $post->...
0
votes
2
answers
67
views
How do I add a class to all sidebars to let a Google Custom Search Engine know not to index the content?
I've replaced the WP search on my site with a Google CSE. Google has a nice feature that lets you specify that certain areas of the page should not be indexable, by adding a "nocontent" class to those ...
1
vote
1
answer
3k
views
Add before_content and after_content to register_sidebar
Is there any way to add two new functions, before_content and after_content to the register_sidebar function? These would work like before_title and after_title, except it would wrap everything that ...
0
votes
1
answer
3k
views
widgets not working
I pasted my siderbar widget code in widgets.php file
function right_sidebar_widget() {
register_sidebar( array(
'name' => 'Right Siderbar',
'id' => 'right-siderbar',
...