mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-28 15:17:42 +02:00
Widgets: add a static
property to WP_Widget_Calendar
to ensure that the id
attribute is only output once.
Props MikeHansenMe, wonderboymusic. Fixes #24604. Built from https://develop.svn.wordpress.org/trunk@34381 git-svn-id: http://core.svn.wordpress.org/trunk@34345 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
eb1e8f41a0
commit
51115a6816
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.4-alpha-34380';
|
||||
$wp_version = '4.4-alpha-34381';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
@ -7,6 +7,16 @@
|
||||
* @subpackage Widgets
|
||||
*/
|
||||
class WP_Widget_Calendar extends WP_Widget {
|
||||
/**
|
||||
* Ensure that the ID attribute only appears in the markup once
|
||||
*
|
||||
* @since 4.4.0
|
||||
*
|
||||
* @static
|
||||
* @access private
|
||||
* @var int
|
||||
*/
|
||||
private static $instance = 0;
|
||||
|
||||
public function __construct() {
|
||||
$widget_ops = array('classname' => 'widget_calendar', 'description' => __( 'A calendar of your site’s Posts.') );
|
||||
@ -25,10 +35,16 @@ class WP_Widget_Calendar extends WP_Widget {
|
||||
if ( $title ) {
|
||||
echo $args['before_title'] . $title . $args['after_title'];
|
||||
}
|
||||
echo '<div id="calendar_wrap">';
|
||||
if ( 0 === self::$instance ) {
|
||||
echo '<div id="calendar_wrap" class="calendar_wrap">';
|
||||
} else {
|
||||
echo '<div class="calendar_wrap">';
|
||||
}
|
||||
get_calendar();
|
||||
echo '</div>';
|
||||
echo $args['after_widget'];
|
||||
|
||||
self::$instance++;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user