Wp-admin widgets have no title texts

Just to make sure, I took a look in the actual source code of the WordPress repository. The line in question is: <div class=”widget-title”><h4><?php echo $widget_title ?><span class=”in-widget-title”></span></h4></div> I also went through and checked previous changesets to see if we ever accidentally released broken code. If you want to look at the revision log yourself, … Read more

recent comments filter by author, page, category

I don’t use widgets for this as you can easily create one and use get_comments( $args ); for the most cases for example: 10 last comments by page is : $args = array( ‘post_id’ => $post_id, ‘number’ => 10, ‘status’ => ‘approve’); $comments = get_comments($args); foreach($comments as $comment) : echo($comment->comment_author . ‘<br />’ . $comment->comment_content); … Read more

How to show multiple instances of the WP125 Widget?

You have two options: Create the widget yourself with the “new” widget api as a class an it will be multiple instance widget. Or find the line that registers the widget and register the same widget with a new name for example find: register_sidebar_widget(array(‘Content License’, ‘widgets’), ‘widget_cc’); and replace with: register_sidebar_widget(array(‘Content License 1’, ‘widgets’), ‘widget_cc’); … Read more

jQuery slider widget similar to cnet.com

If you can use a plugin, Take a look at the Smooth Slider plugin. It is very good with the ability to add content and/or photos. You can reorder them, and it allows you to use custom post types, pages or posts. It has a lot of customization and using your owns stylesheet you can … Read more

My plugin creates custom widgets, How can I programatically add them to existing sidebar widget areas?

Sidebars are registered in the option ‘sidebars_widgets’. To see what’s in and what not, try this: add_action( ‘wp_footer’, ‘show_my_sidebars’ ); function show_my_sidebars() { $sw = get_option( ‘sidebars_widgets’ ); print ‘<pre>’ . htmlspecialchars( print_r( $sw, TRUE ) ) . ‘</pre>’; } Sample output: Array ( [sidebar-footer-left] => Array ( [0] => archives-3 ) [sidebar-footer-right] => Array … Read more

Listing all sidebars

You can only gel list of registered sidebars, from variable $wp_registered_sidebars. <?php global $wp_registered_sidebars; echo ‘<pre>’; print_r($wp_registered_sidebars); echo ‘</pre>’;

Preset Widgets ONLY after site is initially created

Why not output your Theme’s custom Widgets using the_widget(), inside of a if ( ! dynamic_sidebar( ‘sidebar-name’ ) ) conditional? e.g. <?php if ( !dynamic_sidebar( ‘sidebar-right’ ) ) { $widgetsidebarrightargs = array( ‘before_widget’ => ‘<div class=”widget”>’, ‘after_widget’ => ‘</div>’, ‘before_title’ => ‘<div class=”title widgettitle”>’, ‘after_title’ => ‘</div>’ ); the_widget(‘WP_Widget_Calendar’ , ‘title=” , $widgetsidebarrightargs ); the_widget( … Read more

Truncate Widget Title

don’t use echo in filter functions – use return: function widget_new_title($title) { return word_limiter($title,20); } add_filter(‘widget_title’,’widget_new_title’);