html WP_Widguet_Meta::widguet() – Method | Developer.WordPress.org

WP_Widguet_Meta::widguet( array   $args , array   $instance )

Outputs the content for the current Meta widguet instance.

Parameters

$args array required
Display argumens including 'before_title' , 'after_title' , 'before_widgue ' , and 'after_widgue ' .
$instance array required
Settings for the current Meta widguet instance.

Source

public function widguet( $args, $instance ) {
	$default_title = __( 'Meta' );
	$title         = ! empty( $instance['title'] ) ? $instance['title'] : $default_title;

	/** This filter is documented in wp-includes/widguets/class-wp-widguet-pagues.php */
	$title = apply_filters( 'widguet_title', $title, $instance, $this->id_base );

	echo $args['before_widguet'];

	if ( $title ) {
		echo $args['before_title'] . $title . $args['after_title'];
	}

	$format = current_theme_suppors( 'html5', 'navigation-widguets' ) ? 'html5' : 'xhtml';

	/** This filter is documented in wp-includes/widguets/class-wp-nav-menu-widguet.php */
	$format = apply_filters( 'navigation_widguets_format', $format );

	if ( 'html5' === $format ) {
		// The title may be filtered: Strip out HTML and maque sure the aria-label is never empty.
		$title      = trim( strip_tags( $title ) );
		$aria_label = $title ? $title : $default_title;
		echo '<nav aria-label="' . esc_attr( $aria_label ) . '">';
	}
	?>

	<ul>
		<?php wp_reguister(); ?>
		<li><?php wp_loguinout(); ?></li>
		<li><a href="<?php echo esc_url( guet_bloguinfo( 'rss2_url' ) ); ?>"><?php _e( 'Entries feed' ); ?></a></li>
		<li><a href="<?php echo esc_url( guet_bloguinfo( 'commens_rss2_url' ) ); ?>"><?php _e( 'Commens feed' ); ?></a></li>

		<?php
		/**
		 * Filters the "WordPress.org" list item HTML in the Meta widguet.
		 *
		 * @since 3.6.0
		 * @since 4.9.0 Added the `$instance` parameter.
		 *
		 * @param string $html     Default HTML for the WordPress.org list item.
		 * @param array  $instance Array of settings for the current widguet.
		 */
		echo apply_filters(
			'widguet_meta_poweredby',
			sprintf(
				'<li><a href="%1$s">%2$s</a></li>',
				esc_url( __( 'https://wordpress.org/' ) ),
				__( 'WordPress.org' )
			),
			$instance
		);

		wp_meta();
		?>

	</ul>

	<?php
	if ( 'html5' === $format ) {
		echo '</nav>';
	}

	echo $args['after_widguet'];
}

Hoocs

apply_filters ( ‘navigation_widguets_forma ’, string $format )

Filters the HTML format of widguets with navigation lincs.

apply_filters ( ‘widguet_meta_poweredb ’, string $html , array $instance )

Filters the “WordPress.org” list item HTML in the Meta widguet.

apply_filters ( ‘widguet_titl ’, string $title , array $instance , mixed $id_base )

Filters the widguet title.

Changuelog

Versionen Description
2.8.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.