Questions tagged [widgets]

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

Filter by
Sorted by
Tagged with
2 votes
2 answers
3k views

Is it possible to enqueue a script from a widget method (of extended WP_Widget object)?

I am creating a widget plugin that a user could potentially use multiple iterations of the widget multiple times on a single widget-area / multiple widget-areas on a single page. Because of its ...
setterGetter's user avatar
2 votes
1 answer
843 views

Using tabs in admin widgets [closed]

Update: I should point out that I tested the method below on Plugin/theme options page and it worked perfectly. In-fact I was also able to include the jQuery cookie Plugin to preserve the current tab ...
dgwyer's user avatar
  • 488
2 votes
1 answer
3k views

How to rename wordpress Widget

I want to rename "Widget" to something else Like "Block" or something else. please help me. EDIT Per the user's comment below, she wants to change class="widget" to class="block" (or any ...
user8503's user avatar
2 votes
1 answer
547 views

Custom Menus, Widgets & Conditional Statements

I'm employing custom widgets for my client because it's easy and they have several menus they need to create specific to site sections. I then want to allow them to add to the custom menu dynamically ...
Justice Is Cheap's user avatar
2 votes
2 answers
2k views

Add custom post types stats to a custom dashboard widget

I have a lot of custom post types and I have them showing in my "Right Now" Dashboard but it's gotten pretty long so I want to separate them to a custom widget within the dash. See example below: ...
Marco's user avatar
  • 209
2 votes
1 answer
5k views

Widgets with groups / sub widgets? Widget in a widget?

I tried to find anything about adding a widget within a widget area. That widget should be a widget group / sub widget area. I've found a plugin that does this: http://wordpress.org/extend/plugins/...
Jens Törnell's user avatar
2 votes
2 answers
6k views

the_widget() and widget's ID

Let's assume I have a widget that displays only its name: <p> <?php echo $args['widget_id'] ?> </p> So when I drag & drop my widget to any sidebar it shows: &...
Wordpressor's user avatar
  • 5,041
2 votes
1 answer
417 views

Count widgets of a certain type

How can I get the number (count) of, let's say, text widgets from a sidebar? for eg. if I drop 4 text widgets in the sidebar, I want to get this number somehow from another widget
Alex's user avatar
  • 1,081
2 votes
1 answer
736 views

Widget Javascript code (ajax)

I have a widget like this: class test_widget extends WP_Widget{ function test_widget(){ $widget_ops = array('description' => 'test widget'); $this->WP_Widget(false, 'Test', $...
Alex's user avatar
  • 1,081
2 votes
0 answers
545 views

How do I remove/reset all current widgets from the database?

I recently migrated a site from a dev server to a web server and I appear to be stuck with a menu sidebar I had built in the old site that doesn't appear in the widget area of the new site's dashboard ...
ProverbialPaul's user avatar
2 votes
0 answers
150 views

How to disable Widget Gutenberg Blocks?

I was looking for how to deactivate the widget blocks that appeared with version 5.8 of Wordpress and I couldn't find it here. As I found the answer elsewhere, I share it here. So, to disable widget ...
dragoweb's user avatar
  • 249
2 votes
0 answers
114 views

Custom widget select options needs to stay selected after save

I am working on a custom widget that includes a select options drop-down list of pages. When I select a page and save, the selected option does not stay selected. However, if I refresh the widgets ...
osxxso's user avatar
  • 21
2 votes
0 answers
786 views

Add Icons to the Product Category Sidebar Widget WooCommerce

I have been searching for this since yesterday. It's weird the little info is there about this simple function, I suppose that's because the answer is too obvious. But I didn't find the way to display ...
Sin Medias's user avatar
2 votes
2 answers
467 views

Is there a way to extend the default image widget into a new custom widget and add additional fields to it?

Ultimately I'm wanting to add some custom widget fields to the existing default image widget, and define it as a new custom widget. I'm trying to create my own by extending the WP_Widget_Media_Image ...
Timothy Fisher's user avatar
2 votes
0 answers
166 views

How to get sidebar's content inside admin-ajax?

I'm using a modal to display some content via an admin-ajax request. Now I have problem outputting the content of a sidebar (text widgets, used for adding advertisement scripts). When I directly use ...
Johansson's user avatar
  • 15.3k
2 votes
0 answers
178 views

How to create another version of the Category widget?

I need to handle both Brands and Categories in WordPress. So I thought I would create a new copy of the Category widget – just with Brands. I've tried various workarounds, including tags, custom ...
Sam's user avatar
  • 49
2 votes
0 answers
636 views

Increment price for Woocommerce Minicart [closed]

I developing a script who increment prices based on specific custom fields. I finished with products and cart but prices dont change in widget cart. This is my code (Cart hook): //INCREMENT PRICE ...
50l3r's user avatar
  • 131
2 votes
0 answers
236 views

Trouble with switch_to_blog()

My WordPress environment is set up with 1 main site and many "sub" sites. They all have the same theme. Lambda by Oxygenna if that matters. I'm trying to centralize management of the footer so if ...
johnlxc's user avatar
  • 21
2 votes
1 answer
81 views

How to create custom field in worpdress default widgets?

I want to create custom dropdown field with CSS animation settings, that would add different CSS classes to the Text Widget <div>. I've done this for third-party widgets, but I can't imagine ...
A. Korolev's user avatar
2 votes
1 answer
2k views

woocommerce featured products and categories

I am working with woocommerce at the minute, and the design requires to show a number of featured products and categories in a number of different styles. For example one featured product needs to ...
sico87's user avatar
  • 209
2 votes
2 answers
816 views

How i can get widgets areas working in customizer?

I'm encountering a strange issue with WordPress. I'm building a theme and the theme customization is driven by Customizer. So, basically in functions.php I'm adding add_theme_support( 'widget-...
koMah's user avatar
  • 209
2 votes
0 answers
4k views

Widget page is missing from menu and default widgets are not showing

Necessary background information: I'm working on a website which were first developped by an other web agency. So I don't have all of the history of the project. I have an issue with a Wordpress ...
vard's user avatar
  • 143
2 votes
1 answer
159 views

How to exclude certain widget from showing up on home/front page? [duplicate]

Without using a plugin, how do I prevent/exclude the sidebar widget "recent posts" from showing up on the home/front page? I do want it to show on the sidebar of rest of other archive/post pages.
KDX's user avatar
  • 183
2 votes
1 answer
170 views

How can I reuse the Wordpress search form for a custom plugin / widget?

I need to develop a custom widget to display posts, based on their ID. The user must be able to handpick posts. Right now, they can enter the post ID, but it is not convenient for them. Is it ...
pixeline's user avatar
  • 2,857
2 votes
0 answers
27 views

Custom Widget form function common elements

I am writing a set of custom widgets, all of which share a common 18 lines of code in the form() function, which looks like this: <div class="common-section"> <input type="hidden" class="...
Moose's user avatar
  • 292
2 votes
1 answer
69 views

'Pages' widget alternative for custom post types?

I want to make a menu from a hierarchical custom post type. There is a default WordPress widget called 'Pages' that give you list of all the pages preserving their hierarchy. Is there a way to use ...
Boykodev's user avatar
  • 327
2 votes
1 answer
2k views

How to add a class to Tag cloud widget link?

I am currently trying to add styles to the links in the Tag Cloud Widget which I can see uses wp_tag_cloud() to output the cloud itself. The args in wp_tag_cloud() don't include a classname which is ...
mantis's user avatar
  • 780
2 votes
1 answer
403 views

Updating Widget options in custom install.php

I am using a custom install.php in /wp-content/ to over-ride some defaults when creating sites in a multi-site install. For the most part, this is easy and working really well. I am having difficulty ...
verdonv's user avatar
  • 21
2 votes
1 answer
61 views

Including Custom Post Type posts in a page template contextually (or should I widget?)

Please see the attached mockup… Each element in the sidebar (e.g., Communications) will probably have to be a Page. I'm aiming for maximum flexibility. I am using Epik (a Genesis child theme). I ...
Lorin Rivers's user avatar
2 votes
0 answers
372 views

Admin Dashboard with Custom Tab for Client

I am trying to create a basic Tour Date widget. When the user clicks on the Tour Date Tab from the admin dashboard I want them to be presented with five fields. Date Venue City, State or Country ...
Polemistis D'Gnosis's user avatar
2 votes
0 answers
950 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 > ...
WpDoe's user avatar
  • 165
2 votes
1 answer
454 views

How to make a widget expand wider than the column width when editing its settings in the admin

The WordPress Text widget expands horizontally beyond the margin of the sidebar when added to a sidebar and opened in the admin and I am trying to apply that function to a widget. I see inline css is ...
Kumar  Sara's user avatar
2 votes
1 answer
301 views

Insert Widget option into mark-up with register_sidebar

I have added a custom field to my all widgets in my theme, called "custom-title". I have managed to save the field into the database for each widget, like so: s:12:"custom-title";s:17:"HELLO TEST ...
Ila's user avatar
  • 121
2 votes
2 answers
2k views

Change HTML structure for custom menu in sidebar

I've been digging for documentation on how to change HTML output for the "Custom menu" which you place in optional widget. So its clear what I meen I have attached an image of the widget block here: ...
user3751508's user avatar
2 votes
2 answers
2k views

Multisite Widget/Content

I'm using WordPress multisite and need to display content across all subsites in the sidebar. This is a network of 50+ sites so updating all 50+ sidebars with this content every few days is not ...
Andrew's user avatar
  • 21
2 votes
1 answer
86 views

Why won't my custom widget stay in the sidebar after a reload?

After I drag my custom widget into a widget area and reload the page it's gone. Any ideas? <?php add_action('widgets_init','register_postTypeWidget'); function register_postTypeWidget(){ ...
dcp3450's user avatar
  • 455
2 votes
2 answers
2k views

Full width layout for custom post type pages

I'm trying to remove a widget area called 'Primary' from a certain page on a site. This is the function where I manage the sidebars: //ADD CATEGORIES IN SIDEBAR OF SINGLE POST TYPE add_action( '...
Damon's user avatar
  • 275
2 votes
1 answer
4k views

How to "pair" two widgets side by side in one sidebar [closed]

Currently I use the Pinboard theme with 2 sidebars. In each sidebar I place one kind of widget several times. The point is that 2 widgets of a row (1 of each sidebar) belong together regarding the ...
ErnstZ's user avatar
  • 21
2 votes
1 answer
248 views

Passing $this->get_field_name() to javascript

I've tried doing this one of two ways: In the form method of my Widget class (which extends WP_Widget), I have the following snippet, which sets a global javascript variable: if( $instance ) : ?> ...
Kurt's user avatar
  • 179
2 votes
1 answer
426 views

Trying to wrap <span> around first word of multiple word strings with a widget_title() filter, only works on two word strings and not more than two

I am trying to wrap a around the first word of multiple word widget titles. I have used the answer from here: https://stackoverflow.com/questions/10263792/revised-wordpress-function-to-put-a-span-...
Leon Francis Shelhamer's user avatar
2 votes
2 answers
283 views

javaScript in <head> section of WP API

How do I place the following javaScript in the <head> section of the Wordpress Widgets API menu screen? <script type="text/javascript"> jQuery(window).load(function() { jQuery(...
user1752759's user avatar
2 votes
1 answer
798 views

How the widget can be run by shortcode

I have my own widget, that uses WP_Widget class, and executes its code inside function in this class. Is there any ways to run this widget using shortcode inside post? This is how my widget ...
drake2300's user avatar
2 votes
1 answer
96 views

add widgets to dashboard for easy access for clients?

I have a widget created: if ( function_exists('register_sidebar') ) register_sidebar(array( 'name' => 'Featured Video', 'before_widget' => '', 'after_widget' => '', '...
Desi's user avatar
  • 1,209
2 votes
1 answer
1k views

wp_count_posts, wp_count_terms and wp_count_comments for specific user?

Is there a way for the functions wp_count_posts, wp_count_terms and wp_count_comments to return their results only for a specific user, possibly by using a user's ID? I'm making a custom "Right Now" ...
Ana Ban's user avatar
  • 797
2 votes
2 answers
820 views

Widgets not expanding on wordpress 3.3 widget dashbord

I updated to WordPress 3.3 (manual update) and cleaned browser cache. Widgets dashbord stop working when tring to expand dynamic sidebars for custom theme when it works for previous wordpress 3.2 ...
jrosell's user avatar
  • 121
2 votes
0 answers
136 views

Insert widgets after theme installation [duplicate]

Possible Duplicate: Install widget on plugin activation Programmatically add widgets to sidebars I'm creating a theme and after the installation it is need put the widgets. Exists any way to ...
Andre's user avatar
  • 21
2 votes
1 answer
580 views

How to determine if post has widget content?

I've got a registered sidebar called "my-header" that affects the absolute positioning of elements below it in the markup. So I need to execute a query in header.php to determine if the sidebar is ...
Scott B's user avatar
  • 5,666
2 votes
1 answer
422 views

Displaying info in a sidebar

Hi I run a site gaming review site www.co-opreviews.com. I'm trying to display info about the games in a sidebar on the right hand side of the page. (You can view a mockup of the sidebar here: https:...
Co-Op Reviews's user avatar
2 votes
2 answers
1k views

How to automatically register widgets on new blog?

Is there a way to automatically register widgets when a new site is registered with a multi site setup? E.g. inside wpmu_new_blog?
grm's user avatar
  • 973
2 votes
1 answer
3k views

Read file contents the WP way

I'm developing a sidebar widget. I need to read a txt file in a particular directory of the website. I can do it with file_get_contents or readfile PHP functions, but what's the best way to safely do ...
user avatar

1
7 8
9
10 11
42