Widgets are configurable elements used to dynamically build sections of a WordPress theme.

learn more… | top users | synonyms (2)

0
votes
0answers
33 views

Wordpress Widget: How to pass $this->get_field_id() to javascript

I would like to pass $this->get_field_id() from widget to jquery. How can I do? Now, I tried to do like this with no luck. var Id = $('.media').attr('id'); console.log(Id); Result: ...
0
votes
0answers
10 views

How to remove Help tab and the Widget empty border

I only need to know using code in my functions.php, how to remove the Help tab and the Widget border when it's empty. I found answers here but the date is old and things are changed so, i want an ...
0
votes
0answers
9 views

widget titles are hidden when logged out

At some stage of my development i recognized that the titles of the widgets disappear when user logged out of my site. Any Ideas how to debug this error? Might be is_user_logged_in at some point ...
10
votes
1answer
7k views

How to include checkbox in widget backend form?

I'm trying to include a checkbox in my widget back end. But I cannot get the value (on or off) after the user submits it. I thought the value would be stored in "esc_attr( $check )" (as it is when ...
0
votes
0answers
10 views

WordPress Custom Widget Media Upload

OK I am not a programmer and after reading lots of tutorials I have managed to make one custom widget that just works with texts. Now in this code of mine I want to make a media uploader. Can anybody ...
0
votes
1answer
36 views

A/B test options at the widget level [closed]

I am looking for a method to show 1 of 3 different widgets on my site's homepage. I could do this with javascript, but this would increase page weight and I would rather do it at time of render ...
6
votes
5answers
7k views

Adding a div to wrap widget content after the widget title

I'm trying to add a div to a widget's content in my dynamic sidebar. Here is the register code; register_sidebar(array( 'name' => "Sidebar1", 'id' => 'home-sidebar-1', ...
0
votes
0answers
31 views

Error extending widget class defined in another plugin

I am trying to extend a widget class from another (widget) class in a 3rd party plugin - so hierarchy like this: 3rd_Party_Widget extends WP_Widget (in 3rd party plugin) My_Widget extends ...
8
votes
3answers
7k views

Add class to before_widget from within a custom widget

I have a simple custom widget that asks for its width (that is used later in the front end). The width field is a select dropdown, so a user have predefined options. I will have many instances of my ...
0
votes
1answer
2k views

Need some help with “the_widget()” function

I am trying to create code to display certain default WordPress widgets on my e-commerce site. I have 6 content boxes which display WordPress widgets: • Pages • Latest Posts • Archive (last ...
4
votes
1answer
8k views

Adding iframe Content to Sidebar Widget

I'm trying to add an Amazon advertising widget in a WordPress sidebar widget (self-hosted WordPress, v3.1.3). The widget code is basically an iframe. I've tried using the "Text" widget and pasting ...
0
votes
0answers
15 views

How do I keep WP content in sync with an external spreadsheet or document?

I've been thinking about this and googling solutions for a couple days and haven't made much progress, so I figured I'd get some suggestions. I have an intranet site built in Wordpress that has a ...
2
votes
1answer
44 views

When you register a sidebar in Wordpress, is it possible to choose in what order it appears in the admin

I've registered some new sidebars. They are appearing on appearance->widgets screen. However, they appear in two columns and the order is arbituary. Is there a way to config the order and columns in ...
0
votes
0answers
43 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 ...
0
votes
1answer
24 views

How to change text of a widget depend on condition?

I have text widget with default ads on it ( google ads for example ). Sometime, depend on condition like location, time, I need to change the default ads from code, just temporary only. Is there ...
0
votes
1answer
23 views

Shortcode not working in widget

I created the following shortcode: function newsletter_signup_shortcode( $atts ) { $post_type = get_post_type(); // Attributes extract( shortcode_atts( array( 'location' => ...
0
votes
1answer
20 views

How to add a toggle on the left side of my page?

How to add a toggle on the left side of my page and the content on the right side of my wordpress page. The toggle should behave like a menu on the left side(the arrangement)and each heading would ...
0
votes
0answers
14 views

widgets have disappeared from sidebars

I disabled a few plugins (widget logic, tinymce advanced, black studio TINYMCE, remnove widget titles ). I also swapped themes. When I everything backthe widgets I had created have disappeared from ...
0
votes
1answer
16 views

Slider from different widgets

I need some advice. I have added the possibility to pages to have categories with a plugin. I have created a widget for a client that lets a user select a category from a page and select a subpage ...
0
votes
0answers
16 views

Widget Admin page and Javascript enqueuing

I am authoring a WP Widget plugin, and am having problems enqueuing javascript onto the Widget Admin page. The Javascript works when the page is first loaded or refreshed, but when you click "Save" on ...
1
vote
0answers
38 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
0answers
13 views

Order of sidebars in Appearance > Widgets

How do you change the order that the sidebars appear in the Appearance > Widgets page? I have code like: register_sidebar(array( 'name' => 'Home 1', ... register_sidebar(array( 'name' ...
0
votes
1answer
39 views

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 ...
0
votes
1answer
14 views

I've set up an extra field for all the available widgets. How do I show it's value in the front-end?

Thanks to another great post here I managed to set up an extra field (called "subtitle") for all WP Widgets. Now I am trying to make all WP widgets display the value of this extra field (naturally, ...
2
votes
3answers
2k views

Insert a span inside widget title to give a different color to the second word

I'm trying to make my widget titles two-colored; the first word white and the second one yellow. I have no idea how I can insert a span before the second word of every widget title so that I can put a ...
40
votes
6answers
9k views

Where to put my code: plugin or functions.php?

Is there an easy to understand scheme to decide what kind of code belongs to a plugin or the theme’s functions.php? There are many cases and many debates about that topic, mostly because there are ...
0
votes
1answer
17 views

Does current page contain widget or sidebar

Is there a way to detect whether a specific page contains a widget or sidebar. I am aware of is_active_sidebar() & is_active_widget() which return true or sidebar containing the widget, but this ...
0
votes
1answer
83 views

Is it possible to remove <ul><li> from default category widget?

I´m having some difficulty override to default category widgets in my wordpress theme. I created the theme from scratch. I want to remove the <ul><li></li></ul> from ...
0
votes
0answers
21 views

Menus Removed from Custom Widget Area

I’m hoping someone out there can help me out with this issue I’ve been scratching my head about for some time now. At my place of employment we have a WordPress site on our intranet, running a child ...
0
votes
3answers
2k views

Any available action to add content before and after sidebar?

I am looking for inserting a function's output before sidebar's first widget, and one in the end after the last widget Is it possible?
0
votes
0answers
12 views

Stop responsive widgets realigning on website

I've been trawling the net but can't find a lot. Essentially my website is using the customizr theme with site origin page building blocks to create it what it is. I'm trying to stop the widgets (2 to ...
5
votes
4answers
3k views

How to enqueue script if widget is displayed on page?

I created a widget that uses a jquery plugin, and I used is_active_widget to enqueue the script, it's working fine but it's also including the script even on pages that doesn't show this widget. so is ...
0
votes
3answers
569 views

How can I add a new CSS class to a widget?

I want to assign a new CSS class to default widget <ul> in Page/Post creating page in WordPress. How can I do this? See the image below.
0
votes
0answers
27 views

how to prevent google from indexing the calendar widget results?

I added WordPress calendar widget to my website. after that when i search google for my website i see the results pages indexing my calendar instead of the posts. for example this would be my google ...
0
votes
0answers
53 views

Add and remove fields

I'am trying make a wordpress widget. It should add an remove field on click, but it doesn't work. Another field will not displays on page. Can you help me please? (sorry for my english, I am not very ...
0
votes
0answers
27 views

Updated widget options in old_instance

I need to compare the old instance of a name parameter with one the user inputs. If it's different, then I do some other magic. However, the if condition never returns false, despite inputting a ...
0
votes
1answer
43 views

Is there any tab widget plugin supporting third party widgets? [closed]

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 ...
0
votes
1answer
24 views

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 ...
1
vote
4answers
7k views

remove <div class=“textwidget”> from text-widget

When you add a text widget to a sidebar in Wordpress the widget includes this code <div class="textwidget"> How do I remove this without editing the core? FYI - I think this line is located ...
0
votes
1answer
62 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 ...
0
votes
1answer
24 views

Add footer widgets

My website is running on WordPress theme which does not have options to add footer widgets. How can I add it using other ways?
0
votes
0answers
19 views

How do I move a widget in the header?

I am using the Divi theme with the Divi booster plugin. The plugin give me the ability to add a widget into the header below the main menu. I would like to move the widget to above the main menu. Here ...
1
vote
2answers
663 views

instance is empty in function widget()

I am working on a widget for my theme. If I do a print_r($insance) in the form function, the instance array is populated with the correct data. I have checked the database and the correct ...
0
votes
0answers
14 views

Wordpress custom widget into sidebar not showing

I'm trying to add my custom fb_widget to the sidebar. The default widgets can be added. Below is the code for the widget: /** * Adds FB_Widget widget. */ class FB_Widget extends WP_Widget { ...
0
votes
0answers
98 views

How to display most popular posts from certain category in sidebar?

Assume I have a menu based on categories (jazz, rock, classic). I would like to display most popular posts (in sidebar widget) depending on which page I am (on jazz page I would like to have most ...
0
votes
1answer
51 views

Update title of every instance of widget using text field

I have created a simple widget which looks like this: As there are going to be many instances of this I want to know if it's possible to update the title of each instance (where it says 'Membership ...
0
votes
1answer
26 views

Organizing the position of widgetized areas in the backend

Is there a way to position the widget areas in the WP admin -> Appearance -> Widgets page? I've arranged my register_sidebars function in the proper order however they seem to be displayed randomly. ...
8
votes
2answers
5k views

How to store widget fields data as an array?

I am creating a widget, it needs to store about 10 IDs. Right now I'm using following field method to store each of the ID in a separate field. It stores data of each field in a separately in the ...
0
votes
2answers
143 views

How to add new sidebar widget area to child theme?

I want to create a new sidebar widget area in the header of my child theme. What would be the best way to do this? Here is the code for one of the sidebars in the parent theme: <?php add_action( ...
0
votes
0answers
50 views

Uncaught error when calling .select2() on widget update in WordPress widget.php

Uncaught query function not defined for Select2 s2id_widget-daily_deal_widget-__i__-select_product displays when calling .select2() on widget update in WordPress widget.php ...