I want to cleanup all inactive widgets. I tried following snippet as suggested by this answer Script to remove all inactive widgets?. $sidebars_widgets = get_option( ‘sidebars_widgets’ ); $sidebars_widgets[‘wp_inactive_widgets’] = array(); update_option( ‘sidebars_widgets’, $sidebars_widgets ); I also tried deleting option sidebars_widgets directly from the options table. But after page is refreshed, old value is restored with […]
I am creating a feature for my website using a WordPress shortcode. The shortcode is displays an HTML table that contains certain data. I have enabled the short code for widget/sidebar and it is working fine in the widget. The only problem is that my designer has created two different styles; one for post and […]
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=”inputbox” name=”something” /> <?php $choices = [ ‘first’ => array(‘red’,’orange’,’blue’), ‘second’ => array(‘red’,’white’,’blue’), ‘third’ => array(‘green’,’black’,’white’) ]; ?> <?php foreach($choices as $colorset => $colors) : […]
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 with the widgets though. All I want for widgets is the Search widget and a custom Meta widget we use in-house. […]
This question already has an answer here: Call dynamic_sidebar but include/exclude named widgets? 3 answers
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 this widget for custom post types?
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 ANCHOR” I want to use this to add a data-attribute “custom-title” to the mark-up for each widget, on the before_widget argument. I want […]
I want to display the post archives like seen in this picture. Shown by year and on click it should open up the months. I am not sure how to approach this, would you customize the standard WordPress Archives Widget?
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 being dynamically injected when the widget tab is opened and inserts as div style=”z-index: 100; margin-left: -88px;” […]