Changeset 46189 for trunk/src/wp-includes/blocks/archives.php
- Timestamp:
- 09/19/2019 03:17:39 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/blocks/archives.php
r44273 r46189 73 73 <option value="">' . $label . '</option>' . $archives . '</select>'; 74 74 75 $block_content =sprintf(75 return sprintf( 76 76 '<div class="%1$s">%2$s</div>', 77 77 esc_attr( $class ), 78 78 $block_content 79 79 ); 80 } else {81 82 $class .= ' wp-block-archives-list';83 84 /** This filter is documented in wp-includes/widgets/class-wp-widget-archives.php */85 $archives_args = apply_filters(86 'widget_archives_args',87 array(88 'type' => 'monthly',89 'show_post_count' => $show_post_count,90 )91 );92 93 $archives_args['echo'] = 0;94 95 $archives = wp_get_archives( $archives_args );96 97 $classnames = esc_attr( $class );98 99 if ( empty( $archives ) ) {100 101 $block_content = sprintf(102 '<div class="%1$s">%2$s</div>',103 $classnames,104 __( 'No archives to show.' )105 );106 } else {107 108 $block_content = sprintf(109 '<ul class="%1$s">%2$s</ul>',110 $classnames,111 $archives112 );113 }114 80 } 115 81 116 return $block_content; 82 $class .= ' wp-block-archives-list'; 83 84 /** This filter is documented in wp-includes/widgets/class-wp-widget-archives.php */ 85 $archives_args = apply_filters( 86 'widget_archives_args', 87 array( 88 'type' => 'monthly', 89 'show_post_count' => $show_post_count, 90 ) 91 ); 92 93 $archives_args['echo'] = 0; 94 95 $archives = wp_get_archives( $archives_args ); 96 97 $classnames = esc_attr( $class ); 98 99 if ( empty( $archives ) ) { 100 101 return sprintf( 102 '<div class="%1$s">%2$s</div>', 103 $classnames, 104 __( 'No archives to show.' ) 105 ); 106 } 107 108 return sprintf( 109 '<ul class="%1$s">%2$s</ul>', 110 $classnames, 111 $archives 112 ); 117 113 } 118 114 … … 127 123 'align' => array( 128 124 'type' => 'string', 125 'enum' => array( 'left', 'center', 'right', 'wide', 'full' ), 129 126 ), 130 127 'className' => array( … … 144 141 ); 145 142 } 146 147 143 add_action( 'init', 'register_block_core_archives' );
Note: See TracChangeset
for help on using the changeset viewer.