Skip to main content
8 votes

Best way of making multiple sidebars

Defining new sidebar with in your functions.php <?php if ( function_exists('register_sidebar') ) { register_sidebar(array( 'before_widget' => '<li id="%1$s" class="widget %2$s">', ...
Owais Alam's user avatar
5 votes

sidebar parameters (before_widget, before_title) not Working

The issue is in your params array. There was a missing closing > in before_widget and before-title should be before_title. Try this: array( 'name' => 'Sidebar', 'id' => 'sidebar-1', ...
Welcher's user avatar
  • 3,588
4 votes
Accepted

How to delete wordpress menu

Take a look in your widgets. Appearance > Widgets, and remove the ones you don't want.
Monkey Puzzle's user avatar
4 votes
Accepted

Missing argument 2 for a custom function widgets_init

widgets_init isn't a function, it's an action hook. The callback you specify for that hook is generate_sidebars which requires two parameters, but the widgets_init hook doesn't pass any parameters to ...
Nathan Johnson's user avatar
4 votes
Accepted

Show missing Sidebar from Gutenberg admin area

No code changes are necessary, it can be done entirely in the UI. Sidebars appear in the 3 dot drop down menu, the star is just a way to add a shortcut to the top toolbar, e.g. here are the Yoast and ...
Tom J Nowell's user avatar
  • 59.6k
3 votes

Best way of making multiple sidebars

You can differentiate between sidebars inside sidebar.php. I don't know what your purpose is, but let's suppose you want different sidebars on single posts/pages and other pages. In your functions....
cjbj's user avatar
  • 14.6k
3 votes
Accepted

How to use my menu PHP code as sidebar?

wp_nav_menu is a standard WordPress function, so you would just copy/paste that PHP code into sidebar.php using whatever additional arguments you need. However, since the theme has a sidebar.php it ...
Oz Ramos's user avatar
3 votes
Accepted

dynamic sidebar not showing anything

In your functions.php file try register sidebar without putting in function like this register_sidebar(array( //try not to enclose this in function 'id' => 'primary', 'name' ...
Rishabh's user avatar
  • 984
3 votes
Accepted

Display sidebar if blog

There is no conditional tag for the blog page. You have to use both is_home() and is_front_page() to detect this page When you use is_home() and is_front_page(), you have to use them in the right ...
Gareth Gillman's user avatar
3 votes

Add div class to only one widget

Option-1: Using CSS class already provided: Every widget already provides unique id and class to use in CSS rules. So for most styling needs, it's better to use those to generate specific CSS rule ...
Fayaz's user avatar
  • 8,937
3 votes
Accepted

How to get the name and description of a sidebar in theme?

You can use the $wp_registered_sidebars global variable. Like this: global $wp_registered_sidebars; if( is_active_sidebar( 'activity_calendar_en' ) ): esc_html_e( $wp_registered_sidebars['...
Fayaz's user avatar
  • 8,937
3 votes

Move Sidebar from Above Content To Below When Responsive

Depending on which device you want to target, you'll need to use a media query, you can read more about those here: CssTrick: @media only screen and (max-width : 320px) { #content { ...
Aishan's user avatar
  • 762
3 votes
Accepted

Template part vs Sidebar (differences)

The get_sidebar($name); function loads sidebar template file sidebar-{$name}.php if no name in the prentacies is specified it loads the sidebar.php file. get_sidebar() and get_template_part() are ...
Greg36's user avatar
  • 701
3 votes
Accepted

Display tags for current post in sidebar

You can use get_the_tag_list(), you just need to set the 4th argument, $id to get_queried_object_id() which gets the ID of the main queried post/page outside of the loop. You'll want to check ...
Jacob Peattie's user avatar
3 votes
Accepted

if statement with is_active_sidebar()

It doesn't return anything, it just jumps back out of the function. That's basically "If this is neither sidebar-2 nor sidebar-3, don't continue in this function".
janh's user avatar
  • 2,738
3 votes

Remove Sidebar from Wordpress

If Ribbon Lite doesn't have within its configuration settings an option to completely hide the sidebar (e.g. under "Appearance > Customize"), you're likely going to have to modify some of the theme ...
jasonp's user avatar
  • 61
3 votes
Accepted

How do I display the “Archives” widget layout (sidebar) in Wordpress by 'year' then by 'months'?

Changing the default widget would be pretty complicated. However, you can write your own shortcode and function to get your desired list. I'm guessing you want an unordered list in your widget? Put ...
HU is Sebastian's user avatar
3 votes
Accepted

How to enable the default sidebar area?

There is no 'default sidebar area' in WordPress. It's entirely up to themes to register whatever widget areas they need. So you will need to use register_sidebar() to create the areas for widgets to ...
Jacob Peattie's user avatar
2 votes

Show Woocommerce minicart widget in checkout page sidebar? And, how to make this update secure by overriding widget?

It is not recommended to change the core file of the plugin as on the update your changes will be lost. Better use the following code to show cart widget in the sidebar on checkout page add_filter('...
Mubashir's user avatar
  • 121
2 votes

How to hide sidebar widgets in all pages except Hompage?

writing a minimal plugin (´functions.php´) like this should do: add_action('wp_head', function(){ if ( is_home() ) return; // on home it's okay unregister_sidebar('sidebar-1'); ...
Emanuel Gomes's user avatar
2 votes

Widgets not displaying in theme customizer

This is the Real Solution to your problem: All you have to do is make sure the you have add this function to the footer and before the closing tag </body> : <?php wp_footer();?> also make ...
shadi's user avatar
  • 120
2 votes

Display the id list of active widgets of same sidebar?

Despite what you say is_active_widget does work on custom widgets as well. You may just have trouble locating its ID. To help you, here's a snippet that will show the ID of a widget on the widget ...
cjbj's user avatar
  • 14.6k
2 votes

Remove All Widgets from Sidebar

There is a quick way to accomplish this via jQuery and the developer console. First, navigate to Appearance Widgets and open the developer console (I use Chrome so I just hit CTRL+SHIFT+J on the ...
James Revillini's user avatar
2 votes

How to add Sidebar and Full width option in post editor

Wordpress provides a template hierarchy which gives you the flexibility to create custom layouts for posts, pages, archives, etc. To create a custom layout for a specific blog post, you would name the ...
Owais Alam's user avatar
2 votes

Loading scripts only if a particular shortcode or widget is present

with Wordpress 4.7 there is another way to achieve this in your functions.php file, add_action( 'wp_enqueue_scripts', 'register_my_script'); function register_my_script(){ wp_register_script('my-...
Aurovrata's user avatar
  • 1,336
2 votes

How to use my menu PHP code as sidebar?

Here is the 2 different way to show Max Mega Menu in sidebar area Copy and paste the shortcode in your widget area. Copy and paste the php code in sidebar.php file and place it where you want to show ...
shamim khan's user avatar
2 votes

Implementing Sticky Kit on WordPress

To include in the right way in your theme, you need to enqueue jQuery.sticky-kit.js with wp_enqueue_scripts action. add_action('wp_enqueue_scripts', 'enqueue_sticky_kit'); function ...
Benoti's user avatar
  • 2,436
2 votes
Accepted

Add div class to only one widget

You have two possible solutions. 1. The widget_display_callback filter hook This filter hook parameters allows you to target easily the widget instance and override it's arguments. A possible ...
Nabil Kadimi's user avatar
  • 2,686
2 votes
Accepted

dynamic_sidebar() returns false in admin section

Yes, you have to make sure to hook this function at some point after the sidebars are registered. It's not quite explained, but implied in the codex that this function dynamic_sidebar( $index ) ...
iyrin's user avatar
  • 1,796
2 votes
Accepted

Sidebar not appearing in footer, but it appears everywhere else!

The declaration in your footer tells WordPress to find the sidebar-social_media_sidebar_widgets.php file and apply it there. I think what you want is to declare: <?php dynamic_sidebar( '...
Ryan's user avatar
  • 201

Only top scored, non community-wiki answers of a minimum length are eligible