Articles of widgets

All custom widgets are not showing in widget area at the same time

I have created 3 custom widgets named Prakash Category Widget, Prakash Author Widget and Prakash Tag Widget. Their codes are: <?php // Begin Prakash Category Widget /* Plugin Name: Prakash Category Widget Description: A Simple Category Widget Version: 1.0 Author: Prakash Pazhanisamy Author URI: */ class CategoryWidget extends WP_Widget { public function __construct() { […]

How to dynamically add the the input text field in widget?

I have made a widget with input fields. I want to make an add more button to dynamically add the input field the first input field is the default. How can I make it is it possible to do that? Here is my widget code : <?php class ExampleClasss extends WP_Widget { function __construct() { […]

Trying to filter tag cloud args, but it removes the wrapper

I’m trying to reset the font size for tag cloud by using the widget_tag_cloud_args filter as follows: add_filter( ‘widget_tag_cloud_args’, ‘filter_tag_cloud_widget’ ); function filter_tag_cloud_widget() { $args = array( ‘smallest’ => 16, ‘largest’ => 16, ‘unit’ => ‘px’ ); return $args; } This should set the font size for all the tags to 16px. The code does […]

How to add custom tinymce plugin to new text widget

So I have a custom TinyMCE plugin, which adds a button to the editor. I’m using the mce_external_plugins and mce_buttons filter to add my TinyMCE plugin. After WP 4.8 introduced the simple TinyMCE for the new text widget i would like to include my button i that editor as well. For some reason i can’t […]

Widget's Content Mssing in Child Theme

After creating Child Theme with just style.css and functions.php, my content in widgets won’t show up in child theme. To clarify what I mean under ‘Content in Widgets’, lets take for example Footer Area Widget: If I write some text or HTML in widget, it won’t show up in child theme. Also, for some other […]

Correctly Using checked function of WordPress

In the Public Function Update this code is sitting → `public function update($new_instance, $old_instance) $instance[‘description_box’] = $new_instance[‘description_box’]; In the public function widget, this code is sitting → public function widget($args, $instance) { $description_box = $instance[ ‘description_box’ ] ? ‘true’ : ‘false’; In the public function→ public function form( $instance ) { This code is sitting […]

WordPress database error – quick review

This error appears when I try to activate one option in widget. I broke it in multiple lines so it may be easier to review. I hope it should be very quick to fix code for someone who is familiar with SQL. I appreciate your time! WordPress database error: [You have an error in your […]

Passing user enetered value in widget: number of words, for example

<a href=”<?php the_permalink(); ?>”> <?php the_title(); ?></a> The above is the code snippet from one of the widgets of my theme. Now in the widget arrangement, this is the situation → $instance[‘number_of_words’] = absint( $new_instance[‘number_of_words’] ); the above setting is to handle how many numbers of words do we wish to show in the title? […]

Removing default theme widgets

I am trying to remove the default widgets in a theme that I found here: The theme is Terapathy. In case of some of the most used themes, if I select the custom widgets, the default theme widgets disappear. But with Terapathy theme or any of the themes found in that site it is […]

Different widgets in sidebar on sub-children pages?

I’m working on project, where I have different widgets on pages and also different order. Example – on About page I may have chat widget, then e-mail sign-up widget, then testimonials widget. On other page I may have testimonials widget only, followed by chat widget. I’m using this code to show widgets on pages and […]