Articles of widgets

register_sidebar fails when using a include within functions.php

I have registered several sidebars via functions.php like this: // Register sidebars function register_widgets() { // Main sidebar register_sidebar( array( ‘name’ => __( ‘Main Sidebar’, ‘Core’ ), ‘id’ => ‘main’, ‘description’ => __( ‘The main sidebar appears on the right on each page except the front page template and blog.’, ‘Core’ ), ‘before_widget’ => ‘<aside […]

How to use wordpress content class?

<div class=”sidebar_area”> <h4>Sponsor</h4> <div class=”sidebar_content”> <ul> <li><a href=”#”>This is new post</a></li> <li><a href=”#”>This is new post</a></li> <li><a href=”#”>This is new post</a></li> <li><a href=”#”>This is new post</a></li> <li><a href=”#”>This is new post</a></li> <li><a href=”#”>This is new post</a></li> </ul> </div> I like to make my widget like this code. But problem is here I can’t use widget […]

How can I specify that an area of my theme contains widgets?

I am pretty new in WordPress theme development and I am developing a theme that use BootStra CSS framework I have to do that a specific area of my theme can contains some widget\module (I don’t know what is the correct name in WP, I am referring to the settings in the backend that show […]

Error with function in functions.php?

I am using the below function in my custom theme to load posts via AJAX. But for some reason it is breaking the WP ADMIN WIdget Drag and Drop and also showing the White Screen of Death when I uploaded the theme to a live server. I can’t figure out what is wrong I am […]

Hide specific categories from category widget

I’m trying to hide a large amount of categories from my category widget. I’ve tried a few plugins but none of them seem to want to let me use the dropdown option. I looked into the widget_categories_args hook and that seems to be what I want but I can’t get it to work. Anyways here’s […]

Register Script in Plugin Widget

I need to load a separate js file into a widget and just can’t get it to work. So far I have if ( is_active_widget( false, false, $this->id_base, true ) ) { function tab_widget_scripts() { wp_register_script( ‘tabs’, plugins_url( ‘tabs.js’, __FILE__ ), array(), false, true ); wp_enqueue_script( ‘tabs.js’ ); } } in my function __construct() and […]

Can't Write Custom Widget Code In One ECHO

I am creating a WordPress custom widget and I created the below one that is working fine when I add it in function.php. <?php /* ————————————————————————- * * Most Commented Post Widget /* ————————————————————————- */ class show_popular_commented extends WP_Widget { function show_popular_commented() { $widget_ops = array(‘classname’ => ‘show_popular_commented’, ‘description’ => __(‘Show your popular commented posts.’)); […]

'is_author()' logic in widget for author only

So, I have a widget that I only want to show it to the page author. I used the following logic: is_author() However it does not seem to work (it shows non-author) Am I using this logic right? Any suggestions? Thank you

Widgets won't save

I have almost no experience in creating widget area’s and I am stuck at saving the widgets in the widget area ‘red menu’. I have searched a dozen posts but I can’t seem to get it working. I am currently working in WordPress 4.0.1 and this is the code I have: Widgets.php: class Red_Menu_Widget extends […]

Exclude posts from widget while post is showing on home, single and categories

Im using this widget. but im trying to figure out how to get it to not display any posts that are currently being displayed on the home page, single post and categories. Another user raised the same question here Which provided the following solution: add_filter( ‘rpwe_default_query_arguments’, ‘rpwe_exclude_current_post’ ); function rpwe_exclude_current_post( $args ) { if( is_singular() […]