Questions tagged [widgets]
Widgets are configurable elements used to dynamically build sections of a WordPress theme.
2,094
questions
1
vote
1
answer
263
views
How to create a widget or plugin to add custom content to my website?
I've made a dropdown menu of multiple pages on one HTML page.
Right now the only place to change the content of each page is inside the HTML of the theme. But this content will be changed weekly, ...
1
vote
1
answer
100
views
Need help adding additional controls to a custom widget Part 2
QUESTION#1 →
This thread is an extension of what has been discussed here, but since there the answer has been accepted so I am creating a new thread.
There comes a situation many times where we ...
1
vote
2
answers
40
views
Widget for adding HTML markup to a page
I didn't know how exactly I should form my title, so the question may be little different. I am new with WordPress developing and would need some advice. I don't need any code, I just want to hear ...
1
vote
1
answer
93
views
Adding widgets with Featured Image via the Customizer run hundreds of queries
I add a widget via Customizer. It's a simple widget, with basic loop, which displays 5 latest posts where each post have Featured Image. Because of the Featured Image, this widget run hundreds of ...
1
vote
1
answer
4k
views
Child Theme - how to add new widget on a specific place?
I have been looking around and I'm a bit confused and was not able to find the answer for this question so far.
I have created a plain new child skin. My child skin has only 2 files
style.css
/*
...
1
vote
1
answer
129
views
How to insert custom widget in custom sidebar in theme activation?
I've created a custom widgets and i want it to insert in any sidebar i wanted on theme activation. Is it possible?
Btw, here's the code i used for my sidebars
function awesome_register_sidebars() {
...
1
vote
1
answer
1k
views
Create onClick Event to Re-load a Widget
Hey guys I have a "add to favourites" button which, when clicked on, adds a post to a list that a user can view on the page /my-enquiry-list/.
I have managed to create a widget that displays the ...
1
vote
3
answers
4k
views
Widgets missing after update
After doing an update to 4.7, all widgets are missing. I queried the database for any records wp_options like '%widgets%' and all is the same as the backup. What can cause this or how can the widgets ...
1
vote
1
answer
54
views
Widget is to be compatible with all themes
I am developing login widget.
I want my widget look good in any theme.
At the moment it is not perfect, as soon as you start testing it on different themes some things slip to each other, the entire ...
1
vote
3
answers
2k
views
Show tags selection similar to category selection in WordPress
Is there anyway we can display tags similar to category selection in WordPress dashboard when editing/adding posts? If we go to publish a new post, we can see a list of categories as checkbox, I want ...
1
vote
1
answer
8k
views
unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in widget [closed]
i want to display posts with custom style by custom widget in theme
this is my custom widget file
<?php
class box1 extends WP_Widget {
function __construct() {
parent::__construct(
...
1
vote
1
answer
2k
views
Custom shortcode is not working in text widget
I have created function for creating shortcode in function.php. This function looks like below
function related_category_sidebar() {
include_once(WP_PLUGIN_DIR.'/sabai-directory/assets/templates/...
1
vote
1
answer
3k
views
The plugin generated 3 characters of unexpected output during activation
I'm creating a WordPress Widget for show name of advertiser.
When I try to activate the plugin a error
The plugin generated 3 characters of unexpected output during activation. If you notice “...
1
vote
1
answer
1k
views
How to put a variable in a instance in the widget
I am creating a widget that handles order numbers. The basic structure is as follow:
// pretty generic widget functions
public function widget($args, $instance)
{
$order_number = $instance['...
1
vote
1
answer
146
views
How to create Blog Post Specific Widget
I want to create widgets which will display based on post. I have considered the option of creating a widget post type using Advanced custom post type plugin and populate this widget while writing ...
1
vote
1
answer
1k
views
How to output widget
I have the following code to display widgets in the customizer.
function arphabet_widgets_init() {
register_sidebar( array(
'name' => 'Social Media button',
'id' => ...
1
vote
1
answer
50
views
How can i use the same template file with a widget and category loop?
i wrote a widget and i want to use category template which is located in "themename"/template-parts/content.php".
<?php
// Category.php
while ( have_posts() ) : the_post();
get_template_part( '...
1
vote
2
answers
36
views
Create a widget to use shortcode?
I have a plugin (Social Warfare) that I love. But, there's no widget available. What is involved in creating a widget so that I can use the shortcode that seems to work fine on the pages and posts?
1
vote
1
answer
1k
views
Check if the current shortcode is being used in a widget
How can I check if the current shortcode is being used in a widget? I need to disable some shortcode options that are not allowed in a widget.
Someone know how?
1
vote
2
answers
90
views
How to conditionally display widgetized areas in theme customizer?
On my client's site, there will be quite a few widgetised areas - one for each page created plus global ones. The problem is that they all display in the "widgets" section in theme customizer at the ...
1
vote
1
answer
88
views
Custom Widget options in theme
I want to reprogram my first sketch of our theatre club page in wordpress but until now I only have basic knowledge of creating wp pages. As I want the theme to be as customizable as possible I want ...
1
vote
1
answer
4k
views
How to display widgets inside a page content without a plugin?
I want to build a homepage where I can show posts gathered from different categories and having the ability to choose such categories from the admin. I was thinking to use widgets for this. Is the ...
1
vote
1
answer
3k
views
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 ...
1
vote
1
answer
5k
views
Creating a widget with a number of custom fields
I am attempting to create some custom widgets.
I have created one, which only needed a different title field. However I am now stuck when trying to create a widget which allows me to have multiple ...
1
vote
1
answer
3k
views
How can hide widget title if custom widget is empty
I created my Custom Widget with a category filter select. The widget show me the related posts of the current taxonomy term and filter by the selected category.
I would like to hide the widget title ...
1
vote
1
answer
2k
views
Display custom widget, added as a shortcode in the correct place
I've created a custom Widget and I would like to add it to the page content as a shortcode.
function show_custom_widget() {
the_widget( 'WP_Custom_Plugin');
}
add_shortcode('custom-widget', '...
1
vote
1
answer
518
views
How to activate or install the Gallery Widget?
I would like to activate the Gallery Widget which is presented here. It seems that it's part of the general Wordpress distribution but the widget is not listed under Appearance → Widgets. BTW, I don't ...
1
vote
1
answer
142
views
Can I have a widget and sidebars in custom theme?
Wordpress 4.1.1: simular problem to another question: I have a add_action widgets_init call back in which I have a call to register_widget that registers a class and a call to register_sidebar that ...
1
vote
2
answers
1k
views
Get post values of form created by widget in sidebar
I have created this widget function to show a subscription form but from here i am not able to get the the values of input fields when someone submit it. Please help to get post values of the form.
...
1
vote
1
answer
406
views
How to detect if query is runned from widget?
I want to know if exists function that detect if some database query run from widget, for example from recent_posts widget or search_widget.
1
vote
1
answer
2k
views
Extending the WP_Widget_Text class
I am trying to alter the output of the default WordPress text widget. Since the widget is written in OOP I hoped it could be a simple deal of extending the class and overwriting one method – but it ...
1
vote
1
answer
574
views
Warning: Creating default object... when altering Customize panels
I'm trying to move my theme's [only] widget area outside of WP 4.0's nested "Widgets" panel by doing the following:
$footer_widgets_section = $wp_customize->get_section( 'sidebar-widgets-...
1
vote
1
answer
67
views
How to make this change without changing the core? [duplicate]
I couldn't find a way to change this in an upgrade friendly way, and I know I mustn't touch the core!
I need to change the value 'number' to 10 in wp-includes/default-widgets.php
wp_tag_cloud( ...
1
vote
1
answer
637
views
Trigger Submit Event when Widget is added to Sidebar
I need to trigger the submit or "Save" button for a widget when the widget is added to a specific sidebar in the backend. The reason for this is I am setting a certain taxonomy for a Dropdown Menu ...
1
vote
1
answer
6k
views
Theme's default styles are overriding my plugin's custom CSS
I have created a little plugin that creates a widget that I've made, basically just a pretty <ul> element. Unfortunately, all default widget styles are overriding my custom CSS, and adding !...
1
vote
2
answers
793
views
Remove image height/width attributes from Image Widget
The Image Widget includes width and height on the images which I've unsuccessfully have been trying to filter out so I can have fluid width.
I've tried the following, which seems to be the most ...
1
vote
1
answer
3k
views
Right way to update widget on dynamic new input field
I have code to add an input field dynamicly in my theme. I have testd it, as a metabox and it works. But, not in a widget.
First add and update, that codes work, but when I refresh page or try to ...
1
vote
1
answer
429
views
Extending WP_Widget throws error when Monster Widget used
I wanted to override the output for the core Recent Comments Widget. I extended WP_Widget_Recent_Comments made the changes needed and it displays exactly how I want. However, I have now tested the ...
1
vote
1
answer
113
views
Add more widget areas to a theme
what's the best approach to add more widget areas to a theme? currently, my theme has 2 columns that display the widgets, but I'd like to extend it to 4 for example.
It currently looks like this:
...
1
vote
2
answers
1k
views
Debug errors on sidebar
I'm uising a child theme of twentyfourteen on wordpress 3.8. When in debug mode, I get the following errors regarding a widget.
Notice: Trying to get property of non-object in
\wordpress\wp-...
1
vote
1
answer
1k
views
Dashboard Widgets - Add Admin Page With Same Functionality
I have a plugin that has its own dashboard with basically quick-views of relevant data and I wanted to know if there was an "easy" way to mimic the functionality of the admin dashboard where you can ...
1
vote
2
answers
1k
views
Need help using a filter on the default Categories widget
I need to add the "All Categories" item to the default WP categories widget.
I can see that there's a filter that I can hook into in the core (line 485 default-widgets.php).
wp_list_categories(...
1
vote
1
answer
992
views
Most commented last 24h, week, month, year and all time - posts_where
I've removed my old post here, as the posts_where method is outdated.
Thanks to kaiser, this is now how easy it is to list most commented posts within a certain time span:
<?php
$popular = new ...
1
vote
1
answer
1k
views
Can't work out why widget contents disappear from admin
everytime I make a change to any widgets in admin they disappear - sometime just from admin, sometimes from the frontend and sometimes both.
I get them back by adding update_option( 'sidebars_widgets'...
1
vote
2
answers
1k
views
Passing values from a widget to a function within a plugin
I have a plugin that is built with many widgets. A widget's bundle. Each widget creates it's own custom CSS code.
Instead of having messy source code where I display 15 different sets of inline CSS ...
1
vote
1
answer
2k
views
Ajax load more button in Recent posts widget
I create Recent posts widget and i trying to create load more button for it to get more Recent posts links by ajax ,is there any tutorial for how to make it?
1
vote
1
answer
18k
views
Dynamic sidebar based on category
I am new to wordpress, i have developed a basic theme to make a tutorial web site, for that i need a dynamic sidebar based on category,
suppose, i have category A & B, if user is on the A ...
1
vote
1
answer
1k
views
Widgets not activated alert after using get_sidebar()
I stumbled upon avery strange problem while creating a sidebar for my wordpress theme using the get_sidebar() function in header.php.
I inserted the following code in function.php:
function ...
1
vote
1
answer
2k
views
Override widget in function WordPress
Im trying to override the text widget in WordPress. My code looks like this:
class WP_Widget_Text_Custom extends WP_Widget {
function __construct() {
$widget_ops = array('classname' =>...
1
vote
2
answers
5k
views
Making footer widgets responsive
I have 4 footer widgets in the theme I'm working on. It works great. The only thing that I can't get to work is the responsiveness of the widgets. The 4 footer widgets keep on showing up next to each ...