Questions tagged [widgets]
Widgets are configurable elements used to dynamically build sections of a WordPress theme.
2,093
questions
1
vote
1
answer
208
views
isSavingPost() for widgets
I want to get the block ID of my widgets (e.g. #block-1, which is displayed on the frontend after saving a widget) on the widgets screen in the backend. What I try to achieve is to display the ID of ...
0
votes
0
answers
36
views
Console errors in 6.0-RC1 Widget screen
Sine 6.0-RC1 the following console error appears on the block widgets screen, on Firefox:
Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a ...
0
votes
1
answer
508
views
Include widget file in functions.php of child theme
I've created a widget for WP 5.9.3, based on an online tutorial, which I'd got working okay, but it relied on having all the code in the child theme's functions.php, which started looking a bit messy.
...
0
votes
1
answer
97
views
Adding additional text under the price via product page
Hey guys I am wanting to just add this additional text underneath the price (circled in red)
I am using Xstore child theme via woocommerce/WP and have no idea how to go about adding this in or which ...
0
votes
1
answer
17
views
co-authors plugin - inline listing
I'm trying to set up co-authors plugin in order to show articles authors
function inl_users() {
if ( function_exists( 'get_coauthors' ) ) {
$coauthors = get_coauthors();
//array_shift($coauthors);
...
0
votes
0
answers
45
views
Available widgets is not showing up?
I have added theme support in functions.php file.
add_theme_support('widgets');
And register the menu still no available default widget.
class Sidebars{
public function __construct(){
$...
0
votes
1
answer
70
views
How to enable [archives] short code
I want to use the [archives type=yearly] short code on a side bar widget so that people can click on links and see posts for the year. But this is the result I'm getting:
This is what I'm doing in ...
2
votes
1
answer
288
views
gutenberg widget outputting paragraph marks
I have created a shortcode to output a wp_Query. Nowhere in my query do I output any <p></p> paragraph marks. However the widget puts this before my output and after.
At first I thought ...
0
votes
2
answers
129
views
Move position in post list for a custom checkbox column
I have made checkboxes to every post in post list.
Question:
How can I change the the position for the new column.
Now it`s at the right side of the post list. After "Date".
How can I move ...
2
votes
0
answers
401
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 ...
0
votes
1
answer
1k
views
Add checkbox in admin post list - show checked post in widget
I try to make a plugin with a widget where I can mark / check posts, maybe old post I want to bring back to life.
I want to add a checkbox in the field before the title, like I try to show in the ...
1
vote
0
answers
102
views
How to check if a WordPress core block is active in sidebar
I have a widget area and I want to enqueue a stylesheet only if a core block is active in it. I tried the following code:
// if has audio block.
if (has_block('audio')) {
wp_enqueue_style('audio-...
0
votes
0
answers
211
views
Widgets are not displaying in the admin panel
I am using WordPress, I have an issue with the widget. I am not getting the widget in the WordPress admin panel.
I am getting the error in the console
Uncaught (in promise) TypeError: null has no ...
1
vote
2
answers
579
views
Widget editing returns JSON response error
I am trying to modify the sidebar widgets under Appearance -> Widgets, but whatever I do (just change one option, or remove a widget, etc.), as soon as I press the Update button, on the bottom left ...
0
votes
0
answers
19
views
How do you create a custom category widget that you can style?
My first time developing a WordPress theme, and I'm having a hard time understanding the widgets portion of it. Mainly because of my limited understanding of PHP.
This is what I want my categories to ...
0
votes
1
answer
64
views
Allow users to give a dashboard widget a custom name using ACF
I want to use ACF (and CPT) to allow users to give a custom name to an admin dashboard widget from a settings page. In the below code, a widget would be created called "my title". If the ...
1
vote
1
answer
1k
views
How to filter products using filter products by attribute widget and OR logic between different product attribute types?
I have the following query url to filter products by 2 different attribute types:
https://www.example.com/product-category/customized-bags/?filter_wallet-type=womens-wallet&query_type_wallet-type=...
0
votes
0
answers
24
views
Create a List of Widgets, where each widget holds three attributes
i have a specific wordpress page, in which I want to add expandable items.
So the item has a keyword and when I press it, it expands and more specific text will show up.
The styling and setup of such ...
0
votes
1
answer
52
views
How do I find out what is in control over a certain part of a website?
I’ve been trying to get myself familiar with WordPress but with a Joomla mindset I find it quite hard.
In Joomla, when you are trying to find out what is in control over an area, you just need to find ...
1
vote
1
answer
207
views
Is there any way to parse blocks inside widget area?
As widgets are outside post content, i couldn't find the way to parse blocks inserted inside widget area for ex. "sidebar-1"
We use something like below for parsing post contents,
$post = ...
0
votes
0
answers
16
views
Is there any difference between widgets (used in order to manage menus) and register_nav_menus() in terms of performance?
I plan to add in the footer of my website 4 menu areas (such as "About us", "Services", etc.), each area with 3 or 4 links.
In terms of performances, should I use widget ...
1
vote
2
answers
392
views
searchform.php override not working
I'm taking a Udemy class to learn how to make Wordpress plugins and themes. The video I'm on is having me override the default search widget with a custom one via searchform.php. From what I've ...
0
votes
1
answer
154
views
Error code when migrate
I got this error code after migration to different server.
Warning:
require_once(/home/customer/www/noname.com/public_html/wp-includes/widgets/class-wp-widget-pages.php):
failed to open stream: No ...
1
vote
2
answers
1k
views
How a HTML form can trigger a PHP function?
I'm new to the Wordpress/PHP world. I want my page be able to communicate with an API that I build myself. So for this I have a form on my Wordpress Page using a HTML code widget which looks like this:...
0
votes
1
answer
203
views
How to change widget title in wordpress version 5.8.1?
Maybe this is a novice question but I am stumped. I am trying to change the title of a widget (recent posts) in WordPress 5.8.1 version. I have installed WordPress after a long time again and can not ...
0
votes
1
answer
142
views
Retrieve the whole widget sidebar and pass it inside an html
I am trying to pass the sidebar that I have in the shop, inside a side drawer that will have the filters. I have created the HTML/CSS and the js responsible for this to work. But I am trying to get ...
0
votes
1
answer
924
views
How Migrate a Legacy Widget to block?
I'm trying to tranform legacy widgets to block, I was reading the docs, but I couldn't understand where to put this javascript code :
transforms: {
from: [
{
type: 'block',
blocks: ...
0
votes
0
answers
93
views
Custom CSS in Widget editor (Gutenberg) gets stripped out
As of WP 5.8.1 (or 5.8.0) the Gutenberg Editor gets to be default even for Widgets.
So I've started to create some Widgets with Gutenberg blocks. My issue is that if I add custom CSS to the blocks (...
0
votes
0
answers
45
views
Wordpress 5.8 : display new widget
I've started a new website with the newest Wordpress 5.8.
I've made a new widget thanks to the new widget builder which use Gutenberg block.
In my functions.php
register_sidebar(
array(
'...
0
votes
1
answer
261
views
Why do none of my widgets have a title?
I've never seen this issue before, so it could either be a mistake on my part, or a very recent change to WP core, but either way it doesn't make sense for me.
Like usual, I register widgets like I ...
2
votes
1
answer
849
views
Block-based Widgets Editor - how to enable a title
Using the block-based widget editor, how do I add a widget title? I wish to make the title a link to collapse the widget body using bootstrap and register_sidebar:
register_sidebar([
'name' => __(...
0
votes
0
answers
33
views
delete widget upon uninstall
I developped a plugin that makes use of the widgets. It is compatible with both pre-5.8 WordPress widgets (legacy widgets) and the new block editor widgets. The widgets of my plugin do nothing but ...
1
vote
2
answers
3k
views
Determine if a specific Gutenberg block is used on pages/posts
So we have built out a Gutenberg block that is acf_register_block_type as the name pardot-form.
I want to build a widget to basically just display all locations of where that specific block is being ...
0
votes
0
answers
46
views
Can I add Short Code Of A Plugin In The Code Editor of WordPress?
I'm an amateur in WordPress, so need much needed help.
Can I add the short code of a plugin in the code editor of WordPress, will it work?
I need to make some buttons in the frontpage log into a web3 ...
0
votes
1
answer
986
views
Why custom widget won't appear in Block editor (Gutenberg)?
I created a simple custom widget by adding the following code to my functions.php file:
// Creating the widget
class wpb_widget extends WP_Widget {
function __construct() {
parent::...
0
votes
1
answer
321
views
Use atributes of shortcode in get template part
Hi guys im doing a custom shortcode where the client can set a custom taxonomy and display in my sidebar
I want to use a template using the get_template_part but i dont get the terms of the taxonomy
...
0
votes
1
answer
371
views
Customising widget titles/headings in WP 5.8
So I have updated WP to 5.8 and the widget titles are no longer being recognized from my customized functions.php
'name' => __( 'Sidebar 1', 'mytheme' ),
'id' => 'sidebar-1',
...
0
votes
1
answer
158
views
Replace Content of Sidebar on Custom Post Type
sorry, if this is a stupid question, but I am relatively new to php and wordpress development.
I am writing a plugin with a custom post type (course) where a parent page is the course overview and the ...
1
vote
1
answer
139
views
Is there any way to print a widget by having its id?
I have a custom sidebar in wp created by:
register_sidebar(array(
'id' => 'test_w',
'name' => 'test',
'before_widget' => '<div class = "widgetizedArea">',
'...
0
votes
0
answers
108
views
Need help in fixing javascript in Wordpress
I am having a weird and frustrating problem regarding adding javascript to the posts in WordPress. Googled but no luck.
I am adding widget from the N2yo Satellite Tracking website to my website. In ...
2
votes
1
answer
474
views
Find if widget block is active
I'm used to check if a widget from installed my plugin is active.
With the new block editor extending to widgets in WordPress 5.8, I was wondering if there is a way to check the widget block that I ...
2
votes
0
answers
147
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 ...
1
vote
2
answers
38
views
Need some help understanding widgets
I am a Joomla user and very new to wordpress. I've thought Widget was the equivalent of Module of Joomla, but it turns out quite different and I feel like its behavior varies from theme to theme, ...
0
votes
1
answer
854
views
Add filter for specific category only
I've been working on trying to hide all other categories from the category widget when a particular category is selected.
So, as an example, the site has 5x Products categories and and 1x Services ...
0
votes
0
answers
88
views
WordPress 5.8 Beta 3 Widget Block: widget_id is undefined when a widget is placed
I am not sure whether this is already under discussion.
While playing with the new Widget block of 5.8 Beta 3, I got the following notice:
Undefined index: widget_id
I am only trying to create an ...
0
votes
1
answer
23
views
How do widgets access posts they should display?
How do widgets embedded in a page access posts they should display?
How do widgets (php code) in the page access the posts they should display (via the used template's post loop / with wp_query and ...
1
vote
1
answer
1k
views
How to transform a legacy widget into a block
WP 5.8 (not released yet) will include support for transforming legacy widgets into blocks. I have a custom legacy widget I'm trying to add support for transforming it into a block. Reading the docs I ...
1
vote
0
answers
21
views
Save Widget State Between Theme Swaps?
I made my own custom sidebar widgets in my custom theme's functions.php file.. I noticed that when I swap my theme and then swap back, one of my sidebar loses it's configuration and I have to go in ...
0
votes
0
answers
733
views
How to fetch WordPress database values in JavaScript widget
I am making a WordPress widget. There are 4 screens of my widget with some input fields and buttons. on first load i display only first screen and hide the others. The idea is to display the second ...
0
votes
1
answer
52
views
How does update method in Widget class saves $instance array from Select tag?
Following a tutorial and it works fine. I just can't understand how update method saves $instance array in the database from Select tag? You can choose default or full, slick save in the admin area ...