40 * @param array $args Display arguments including 'before_title', 'after_title', |
40 * @param array $args Display arguments including 'before_title', 'after_title', |
41 * 'before_widget', and 'after_widget'. |
41 * 'before_widget', and 'after_widget'. |
42 * @param array $instance Settings for the current Meta widget instance. |
42 * @param array $instance Settings for the current Meta widget instance. |
43 */ |
43 */ |
44 public function widget( $args, $instance ) { |
44 public function widget( $args, $instance ) { |
45 $title = ! empty( $instance['title'] ) ? $instance['title'] : __( 'Meta' ); |
45 $default_title = __( 'Meta' ); |
|
46 $title = ! empty( $instance['title'] ) ? $instance['title'] : $default_title; |
46 |
47 |
47 /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ |
48 /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ |
48 $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); |
49 $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); |
49 |
50 |
50 echo $args['before_widget']; |
51 echo $args['before_widget']; |
51 |
52 |
52 if ( $title ) { |
53 if ( $title ) { |
53 echo $args['before_title'] . $title . $args['after_title']; |
54 echo $args['before_title'] . $title . $args['after_title']; |
54 } |
55 } |
|
56 |
|
57 $format = current_theme_supports( 'html5', 'navigation-widgets' ) ? 'html5' : 'xhtml'; |
|
58 |
|
59 /** This filter is documented in wp-includes/widgets/class-wp-nav-menu-widget.php */ |
|
60 $format = apply_filters( 'navigation_widgets_format', $format ); |
|
61 |
|
62 if ( 'html5' === $format ) { |
|
63 // The title may be filtered: Strip out HTML and make sure the aria-label is never empty. |
|
64 $title = trim( strip_tags( $title ) ); |
|
65 $aria_label = $title ? $title : $default_title; |
|
66 echo '<nav role="navigation" aria-label="' . esc_attr( $aria_label ) . '">'; |
|
67 } |
55 ?> |
68 ?> |
56 <ul> |
69 |
|
70 <ul> |
57 <?php wp_register(); ?> |
71 <?php wp_register(); ?> |
58 <li><?php wp_loginout(); ?></li> |
72 <li><?php wp_loginout(); ?></li> |
59 <li><a href="<?php echo esc_url( get_bloginfo( 'rss2_url' ) ); ?>"><?php _e( 'Entries <abbr title="Really Simple Syndication">RSS</abbr>' ); ?></a></li> |
73 <li><a href="<?php echo esc_url( get_bloginfo( 'rss2_url' ) ); ?>"><?php _e( 'Entries feed' ); ?></a></li> |
60 <li><a href="<?php echo esc_url( get_bloginfo( 'comments_rss2_url' ) ); ?>"><?php _e( 'Comments <abbr title="Really Simple Syndication">RSS</abbr>' ); ?></a></li> |
74 <li><a href="<?php echo esc_url( get_bloginfo( 'comments_rss2_url' ) ); ?>"><?php _e( 'Comments feed' ); ?></a></li> |
|
75 |
61 <?php |
76 <?php |
62 /** |
77 /** |
63 * Filters the "Powered by WordPress" text in the Meta widget. |
78 * Filters the "WordPress.org" list item HTML in the Meta widget. |
64 * |
79 * |
65 * @since 3.6.0 |
80 * @since 3.6.0 |
66 * @since 4.9.0 Added the `$instance` parameter. |
81 * @since 4.9.0 Added the `$instance` parameter. |
67 * |
82 * |
68 * @param string $title_text Default title text for the WordPress.org link. |
83 * @param string $html Default HTML for the WordPress.org list item. |
69 * @param array $instance Array of settings for the current widget. |
84 * @param array $instance Array of settings for the current widget. |
70 */ |
85 */ |
71 echo apply_filters( |
86 echo apply_filters( |
72 'widget_meta_poweredby', |
87 'widget_meta_poweredby', |
73 sprintf( |
88 sprintf( |
74 '<li><a href="%s" title="%s">%s</a></li>', |
89 '<li><a href="%1$s">%2$s</a></li>', |
75 esc_url( __( 'https://wordpress.org/' ) ), |
90 esc_url( __( 'https://wordpress.org/' ) ), |
76 esc_attr__( 'Powered by WordPress, state-of-the-art semantic personal publishing platform.' ), |
91 __( 'WordPress.org' ) |
77 _x( 'WordPress.org', 'meta widget link text' ) |
|
78 ), |
92 ), |
79 $instance |
93 $instance |
80 ); |
94 ); |
81 |
95 |
82 wp_meta(); |
96 wp_meta(); |
83 ?> |
97 ?> |
84 </ul> |
|
85 <?php |
|
86 |
98 |
87 echo $args['after_widget']; |
99 </ul> |
|
100 |
|
101 <?php |
|
102 if ( 'html5' === $format ) { |
|
103 echo '</nav>'; |
|
104 } |
|
105 |
|
106 echo $args['after_widget']; |
88 } |
107 } |
89 |
108 |
90 /** |
109 /** |
91 * Handles updating settings for the current Meta widget instance. |
110 * Handles updating settings for the current Meta widget instance. |
92 * |
111 * |