Articles of widgets

How to allow editing of text in sidebar?

I am developing a theme which has an area of the sidebar which displays the blog owner’s bio and photo as a background image. I could hard-code this information, however, I’d like to learn how to make this text (and possibly the background image) editable in the WordPress admin. I think this is referred to […]

Shortcode not working in widget

I created the following shortcode: function newsletter_signup_shortcode( $atts ) { $post_type = get_post_type(); // Attributes extract( shortcode_atts( array( ‘location’ => get_permalink(), ‘show_title’ => ‘yes’, ), $atts ) ); // Return the unfiltered content if we’re not on a post. if ( $post_type != ‘post’ ) { return $content; } ob_start(); ?> <!– MailChimp Signup Form […]

Add footer widgets

My website is running on WordPress theme which does not have options to add footer widgets. How can I add it using other ways?

I've set up an extra field for all the available widgets. How do I show it's value in the front-end?

Thanks to another great post here I managed to set up an extra field (called “subtitle”) for all WP Widgets. Now I am trying to make all WP widgets display the value of this extra field (naturally, after_title, since it’s the subtitle), but I can’t quite figure this out. Here is the code I use […]

WordPress Widget Not Saving Instance

I have very simple wordpress widget, that has 3 input field. Whenever i submit data, it does not save to database. I have added and deleted the plugin , deactivated and reactivated multiple times, but no luck. Below is my code :- class price_package extends WP_Widget { function __construct() { parent::__construct( ‘price_package’, ‘Price Package’, array( […]

How to use title attributes in sidebar widget?

I have a custom post type “article” & I need to display some custom urls is a widget in the sidebar using php code widget. When I use this code withing the loop it works perfectly: <a href=”<?php echo site_url(‘/article/full-text/’); ?> <?php $slug = $post->post_name; echo $slug; ?>” title=”<?php the_title_attribute(); ?>”>Full Text</a> but when I […]

Is it possible to remove <ul><li> from default category widget?

I´m having some difficulty override to default category widgets in my wordpress theme. I created the theme from scratch. I want to remove the <ul><li></li></ul> from categories in the lists. I want to add my own style using <a href=””></a> instead <div class=”list-group”> <a href=”#” class=”list-group-item”>LifeStyle</a> <a href=”#” class=”list-group-item”>SmartPhones</a> <a href=”#” class=”list-group-item”>Business</a> <a href=”#” class=”list-group-item”>Graphic […]

A/B test options at the widget level

I am looking for a method to show 1 of 3 different widgets on my site’s homepage. I could do this with javascript, but this would increase page weight and I would rather do it at time of render (native wp or php solution). The solution does not have to be a true A/B test […]

Load widget only on blog posts

I am attempting to ensure a widget is only loaded on blog post pages. I tried using $post_type = get_post_type( $post_id ); inside the widget function of my widget class. However, upon loading pages like the homepage, ‘archives’, ‘categories’ etc. . . the post type is always ‘post’. The only exception is when I create […]

Why can't I see “Widgets” in my Apperance menu?

So I am trying to create a widget-area. And after adding some code to the functions.php I noticed that I can not see “Widgets” in my menu. So I figured I had to add “widget support” to my theme so I started to search for this, but it seems there is function to register support(?) […]