Articles of widgets

Load widget only on blog posts

I am attempting to ensure a widget is only loaded on blog post pages. I tried using $post_type = get_post_type( $post_id ); inside the widget function of my widget class. However, upon loading pages like the homepage, ‘archives’, ‘categories’ etc. . . the post type is always ‘post’. The only exception is when I create […]

Why can't I see “Widgets” in my Apperance menu?

So I am trying to create a widget-area. And after adding some code to the functions.php I noticed that I can not see “Widgets” in my menu. So I figured I had to add “widget support” to my theme so I started to search for this, but it seems there is function to register support(?) […]

Widget page stopped loading

I’m currently having an issue with the widgets page in the backend. however I’m having a heck of a time identifying what’s break the page. I’ve found there are 3 widgets that when removed from the theme, the page loads correctly. The page stops loading before the widget description in the left column of the […]

Is there any tab widget plugin supporting third party widgets?

I am searching such a tab widget supporting third party widgets, such as YARPP, TOC+, Ultimate Tag Cloud. The following two popular tab widgets doesn’t meet my requirements. WP Tab Widget: only supports: Popular Tab, Recent Tab, Comments Tab, Tags Tab Tabs Shortcode and Widget: only supports: Text Tab (HTML is allowed)

How not to display an instance of a widget dynamically?

How to change the CSS style for an instance of a multi instance widget dynamically depending on the result of an SQL query? When the query returns nothing at all, I would like that the instance of the widget is not displayed. But if the query returns a result, I would that this result is […]

Add drop down to widget if it is in a certain area

Is there a way to programmatically add a dropdown selector to any widget added to a given widget area? I have a header widget area and I’d like any widget added to it to have a dropdown box with the option to align the widget to the left right or centre. This would then be […]

Widgets in WP 4.3 disappearing – How to fix?

I definded my widgets as seen in the following code. Since update 4.3 WordPress did some changes i can not fix. Any ideas what i need to change in order to see the widget in the frontend again? I can edit and see it in the backend widget menu, but not in the frontend. class […]

Is there a way to use get_sidebar() when no widgets are activated?

WP version 4.4.2, I have a customized sidebar.php and no widgets activated, which automatically prohibits get_sidebar() function to load contents of sidebar.php. Is there a way to forcefully load sidebar.php file?

Enabled checkbox by default in WordPress widgets

The code works as expected. The issue happens if I set ‘show_post_count’ => 1 by default. In this case checkbox will be enabled always. How should I update the code to work as expected even if checkbox value set to 1 by default. <?php class Custom_Archives_Widget extends WP_Widget { /** * Register widget with WordPress. […]

How do I insert an amazon search widget into posts or pages?

How do I insert an Amazon Search Widget into posts or pages? The source code is: <SCRIPT charset=”utf-8″ type=”text/javascript” src=”″> </SCRIPT> <NOSCRIPT><A rel=”nofollow” HREF=””> Widgets</A></NOSCRIPT> EDIT: The reason why the widget doesn’t appear after embeded the above code into HTML is that the widget is blocked by AdBlock.