Questions tagged [widgets]
Widgets are configurable elements used to dynamically build sections of a WordPress theme.
2,093
questions
0
votes
1
answer
65
views
Widget recent comment filter by post meta_value
How to filter recent comment by post meta value.
I have a key “target” in post_meta, and I want to display in my new recent comment widgets.
My code :
$comment = get_comments(
array(
‘number => $...
0
votes
1
answer
214
views
Need to delete the sidebar widget area and have the page a full page rather than just have a blank widget area
A recent post on how to remove the archives and meta from the sidebar answered a question I had and I was successful to have the left side of the page blank. The post was at Can not Remove Archives ...
0
votes
0
answers
19
views
How to decorate WP_Widget_Text?
Im trying to do an extended WP_Widget_Text, and to be professional, lets use a decorated design pattern.
This is all I have:
<?php
namespace X;
class CustomHtml extends \WP_Widget
{
/**
* ...
1
vote
0
answers
46
views
Is it possible to make widget return only data (eg, array)?
I want to make widget to return only data (array variable).
Here is the code of my widget custom class:
class ContactInformationWidget extends WP_Widget {
function ContactInformationWidget() {
...
0
votes
1
answer
469
views
Trying to style Woocommerce sidebar Cart Widget [closed]
I have looked at length to find CSS that will change the background color, border radius and product info text color. I think this may not be a "mini cart". The price of the item, subtotal ...
0
votes
1
answer
146
views
script not working anymore after saving widget settings
I have built a plugin with a widget. This widget has possibly many lines of setting fields, so I devided it in collapsable sections like it is possible with the widgets and sidebars itself. This all ...
0
votes
1
answer
371
views
How do I find out which <select ><option </option> was clicked on?
I am trying to build a widget that has a dropdown (<select), a Text input, a textarea and a submit input. When the widget function builds the components & populates the dropdown from the ...
1
vote
0
answers
58
views
How to add media field to WP_Widget form function?
I am creating simple WP_Widget plugin and I want to add one filed to form function inside it. I want to allow user to pick some photo from wordpress media. I know how to implement input text, textarea ...
0
votes
1
answer
25
views
The styles in the recent posts widgets plugin not working
I am trying to add a wordpress recent posts widget plugin in a theme
but somehow even after adding the same class the styles ae not reflecting in the front end
i tried to enqueue style in the plugin ...
0
votes
2
answers
84
views
Is it bad to add html to a widget by closing and reopening the php tags?
I've just started making my own WordPress widgets and don't have a very good understanding of good practices with PHP or HTML. To add html to a widget I have seen two different methods, the first ...
0
votes
0
answers
22
views
Some Widgets in the Right Side Bar and the whole Footer section is not working in a Wordpress Site
My WordPress Website is not working properly. Some Widgets in the Right Side Bar and the whole Footer section is not working. I contacted Theme Support (Generatepress) first. They checked it and told ...
0
votes
0
answers
216
views
Exclude a category from block editor's category widget
I have added category widget form block editor.
It shows the list of all categories.
I want to exclude a category from that list.
How can I exclude a category from this list?
0
votes
1
answer
259
views
Widget not appearing in customizer
Hello I have a theme installed but on the homepage the homepage content widget section does not appear in the customizer view. I have it set on the wp-admin themes settings but when I go to the ...
0
votes
1
answer
85
views
After adding widget the style is messing up
I add a widget area to a wordpress theme but the style is somehow not matching with html
here is the image
before adding widget
after adding widget
widget area
functions.php
<?php
//Adding the ...
0
votes
1
answer
17
views
Current WordPress Page Title as Search Parameter into A Tag <a href=“www.domain.com/s?=currentpagetitle”></a>
i would like to include an affiliate link as a widget which inserts the title of the respective page as search parameter.
<a href="www.amazon.com/s?=titleofthepage">Link</a>
I have ...
1
vote
2
answers
29
views
for class wp_widget, in what order are the member functions called?
When a widget is used, in what order are the members used? Obviously, __construct is first, but what happens next? function widget()? function form()?
Which comes first, the chicken or the egg?
0
votes
1
answer
16
views
How do I get my custom widget to show on live site?
I have created a widget that has labels & inputs & a dropdown. It shows and works on the management screen but on the live site the widget cannot be seen,
I have tried some css for dropdowns, ...
0
votes
1
answer
227
views
include specific Pages to wp_list_pages with filter
How can i make a simple filter to display only specific pages (include instead of exclude) as an output to wordpress pages widget?
I made this code , but its not working
function specific_pages($...
0
votes
1
answer
761
views
Loading the native Wordpress image uploader in custom widget
Is there an easy way of adding the native image uploader from the 'Image' widget that comes with Wordpress to a custom widget?
The WP_Widget_Media_Image class.
I would have thought there would have ...
1
vote
1
answer
189
views
Best practices regarding the creation of custom widgets?
I am creating a theme, and I need to create and register a couple of custom widgets for my sidebar.
I need to extend the widget class (for every widget) to do this, which produces a metric ton of ...
0
votes
1
answer
84
views
Mobile view: how to remove right/left margin from the specific widgets?
May I know how to remove right/left margin from the bottom two parts(Lessons and Fees,Contact) of my website on phone? It seems ok on PC but not on phone. Especially the table for prices lookes ...
0
votes
1
answer
163
views
What is the right way to populate a dropdown from MySql?
I am having a heck of a time solving this problem. Please help me find the right way to do this.
I am creating a widget that has a dropdown populated with data from custom table;
This is the form code:...
0
votes
1
answer
56
views
How to create a widget with a populated dropdown?
(added the code; I thought I had it in here)
I am trying to build a widget that has a dropdown.
public function form($instance) {
global $wpdb;
global $event;
global $events;
...
0
votes
1
answer
9k
views
How can I display the category name in the single post when using WP Blog and Widget?
I am using the free version of WP Blog and Widget plugin for my blog. It's working perfectly.
My issue is, I have to display the current post category name on my single page. So I tried below code on ...
0
votes
1
answer
197
views
How do i bring out post category name in my widget?
I customize the repeat post widget and add little functionalities to it. Everything is working fine but my challenge now is that the widget when used is not bringing out individual post category name. ...
0
votes
0
answers
47
views
Unable to see Widget Submenu under Appearance with Class Based WP_Widget
I am trying to create custom widget it appear into a ACF (Advanced Custom Fields) plugin but "Widget Menu is not appearing below appearance menu. here are my codes.
my functions.php
<?php
## ...
0
votes
1
answer
13
views
Widget is displayed in two places
I want to add a widget below page content in my child theme. I used a function from here: https://codex.wordpress.org/Widgetizing_Themes and the widget is displayed where I want:
but it is also ...
0
votes
1
answer
361
views
How to pass data to javascript in custom widget class
I have a custom widget where the user can insert an username in an <input> field. It's working fine, but I need to get the inserted value from php and pass it to the javascript file that is ...
2
votes
0
answers
738
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 ...
0
votes
0
answers
414
views
sidebar in 2020 theme as a widget
I am using the default 2020 theme for my wordpress site which has a static page displayed as the front-end.
Now I want a sidebar (right) to display my links (blogroll) and recent posts.
Where is the ...
1
vote
1
answer
230
views
Display Custom Toxonomy In WordPress and theme Widgets category selection dropdown list
I need help on how to make Custom Toxonomy
or categories for 'Video' CPT to appear in both WordPress native widgets and theme Widget's category dropdown options list. The only categories am getting ...
1
vote
1
answer
2k
views
List monthy archives for specific year with wp_get_archives
I just want a simple list with the monthly archives for one specific year. Like so:
January
February
March
April
etc.
I don't need anything fancy like yearly grouping. Ideally I would like a ...
0
votes
1
answer
414
views
How to get dropdown instance value in WordPress custom Widget
I am building a custom widget for my custom taxonomy and custom post type. basically it is a widget which displays recent posts from custom post type(game). I want to give the user an option to choose ...
0
votes
1
answer
28
views
Widget display nothing
I have 6 widgets in Wordpress. Three works correct, but three display nothing. Code of one which is not working is:
register_sidebar(array(
'name' => __('Title Footer Menu Third'),
...
0
votes
1
answer
290
views
How can I add a widget area to the top of the Dashboard?
I'm interested in adding a widget area to the top of the Dashboard page at site URL /wp-admin to display some important notes for the editors/developers of the site.
How would I go about this?
0
votes
1
answer
478
views
How to filter widget(s) based on a specific category landing page
I apologize in advance if this question seems too basic. But I can't find any resources on Google that helps me to further my research.
My scenario:
I have a total of 3 unique category landing ...
0
votes
0
answers
29
views
Trying to change widgets h-tags
I have created a child theme of moesia-pro-ii. The moesia theme has a widget folder with a php file named "fp-latest-news". In default this widget uses h4 tags. I want to change the h4 to h3 tags in ...
0
votes
1
answer
40
views
dashboard widget form not submit mails
I'm adding for the first time a wordpress dashboard widget. I'm creating a simple form to give the user the ability to send support request directly from wp dashboard. I'm not sure if all the code is ...
0
votes
1
answer
2k
views
Tabs widget from Elementor is not showing the content in it to users. But at admin side it is working fine
As you can see in attached screenshot it is just showing the title name of tabs nothing else. By clicking on the titles nothing it will do. So, This is how users having experience. It is working and ...
0
votes
1
answer
38
views
How could I change contact details in the footer?
I somehow was able to change contact details in the footer, but now I can't find out where to edit in. Looks like widget and customization areas don't contain it.
Website: https://fito.one/about/
0
votes
0
answers
128
views
How to update a widget data?
I have a image widget and I want to update image url programmatically in php.. I will use a cron job and it is not a problem but I can not update the image url. When I try to update it with query, the ...
-2
votes
1
answer
372
views
Random disappearance of footer widgets [closed]
The footer widget disappear on their own after few days even if the website is untouched. This happened 4-5 times before and I don't see any security audit log of widget events nor any malware ...
0
votes
1
answer
309
views
Quick Draft widget (dashboard.php) using custom post_type
I'm trying to amend the WP dashboard widget 'Quick Draft' to accept a custom post_type avada_portfolio (Avada Fusion Theme) but the page just hangs each submission test.
There was a similar question ...
0
votes
1
answer
460
views
How can I have sidebar widgets on Twenty Seventeen theme on all pages?
How can I have sidebar widgets on Twenty Seventeen theme on all pages? Right now it's possible only on Blog page, not on any other page.
Thanks for any help,
Afan
1
vote
1
answer
63
views
How to output only blockquotes content from recent posts in a widget?
I created a simple widget that displays recent post titles. How can I only display the content that is between < blockquote >< /blockquote > from recent posts?
For example, all my posts have a ...
0
votes
0
answers
32
views
Text widget is placing everything side by side. I want to post it above
As I add text widgets within a page in my home screen, They are going side by side. I have three text widgets as if there are three columns of text in my page. I like this, but i want to put a title ...
0
votes
1
answer
3k
views
Uncaught Error: Call to undefined function wp_get_current_user() in
My simple plugin gives error:
// Class wpb_widget ends here
add_action('init','do_stuff');
function TopAuthor() {
$contributor_ids = get_users( array(
'fields' => '...
1
vote
1
answer
782
views
Adding widget to dashboard with wp_dashboard_setup not working
I just separated my functions.php file into smaller files and the required each of those inside functions.php
One of those files is 'dashboard.php' where I add a widget to change a notice in my shop.
...
1
vote
1
answer
1k
views
Ajax gives 400 error
Basically I am trying to fire an ajax call in an Elementor widget.
So I have a button on the click it executes a function in the widget class.
To elementor basic template I have added this.
...
0
votes
1
answer
765
views
Load script on frontend from widget plugin
I need a bit of help for a plugin I'm writing. I need to load a custom stylesheet and a custom script that are needed on the frontend only. Usually I use the wp_enqueue_script and wp_enqueue_style ...