Articles of widgets

Show widget when not using SSL

My wordpress site supports http and https. What I want to do is to add a widget when surfing over http that says something like “Surf this site secure” to show the visitor that I also have a secured version. I don’t want to force them to surf over SSL because I’m using a type […]

Why does WordPress stores widget options in a multidimensional array?

I have a widget with 6 different options. When I use get_option, it gives me a multidimensional array, with all my options inside the inner array, like so: $options = get_option(‘widget_widgetname’); var_dump($options); And the output for var_dump is: array(2) { [2]=> array(5) { [“string”]=> string(6) “Search” [“title”]=> string(12) “WDSearchForm” [“show_wrapper”]=> string(0) “” [“animate”]=> string(0) “” […]

How do I stop a widget from displaying on mobile site?

On my main site I have used the search widget in the sidebar. However, the mobile theme I am using (minileven) already has a search box built into its menu bar. This results in a second search box in the sidebar (which appears after the post content) due to the widget. How do I stop […]

Create Image Uploader for Widget

I found this post// Use Media upload in custom widget on wordpress 3.5 I’m not experienced in any of this so I pretty much just copied the code he provided into my own functions.php file. I uploaded the JS and everything… I then replaced certain code that “sven” posted in his answer. The uploader works […]

Inserting shortcode into a Text widget

hi i’m trying to insert a short code into a Text widget but all its doing it showing the code and not processing it. <?php echo do_shortcode(‘ [stream embed=false share=false width=500 height=560 dock=true controlbar=bottom bandwidth=high autostart=false playlistfile=http://www.xxx.com/wp-content/uploads/videos/playlist.xml config=http://www.xxx.com/wp-content/uploads/videos/config_for_playlist.xml playlist=bottom repeat=none /] ‘); ?>

How Can A Widget With Only One Instance Be Defined?

How can a widget which of which only one instance can be used?

Remove the widgets tab from theme customizer

In some of our sites, I would like the site admins to customize the widgets only on the widget page, and not in the Theme Customizer. How can I remove the widget tab from there?

WordPress: Apply filter/hook to a particular sidebar widgets?

I’m developing a theme that has more than 5 different sidebars and I want to apply a function to a particular one of them for styling purposes. Basically, the function will modify it’s params using a counter to show random ‘s between each of the widgets. I came up with that: function widget_params( $params ) […]

Adding custom html and standard widgets to sidebar

I want to add both custom html that advanced text widgets can’t support and the standard sidebar widgets in the same sidebar. However, when I put a sidebar widget into the theme, it removes all the custom html and just displays the widgets in the sidebar. It shouldn’t be a tough fix, but I am […]

Retrieving list of a custom post type in a widget without using WP_Query?

I’m using the following widget to retrieve a list of the custom post type jobs: class FeaturedJobsWidget extends WP_Widget { function FeaturedJobsWidget() { $widget_ops = array(‘classname’ => ‘FeaturedJobsWidget’, ‘description’ => ‘Displays a random post with thumbnail’ ); $this->WP_Widget(‘FeaturedJobsWidget’, ‘Featured Jobs’, $widget_ops); } function form($instance) { $instance = wp_parse_args( (array) $instance, array( ‘title’ => ” ) […]