• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Yoast SEO a2z

Yoast SEO a2z

WordPress SEO a2z

  • Home
  • Plugins
  • Blocks
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / _yoast_display_notifications() – Create the notifications HTML with restore/dismiss button.

You appear to be a bot. Output may be restricted

Description

Create the notifications HTML with restore/dismiss button.

Usage

$string = _yoast_display_notifications( $notifications_list, $status );

Parameters

$notifications_list
( array ) required – List of notifications.
$status
( string ) required – Status of the notifications (active/dismissed).

Returns

string The output to render.

Source

File name: wordpress-seo/admin/views/partial-notifications-template.php


Lines:

1 to 36 of 36
  function _yoast_display_notifications( $notifications_list, $status ) {
    $notifications = '';

    foreach ( $notifications_list as $notification ) {

      switch ( $status ) {
        case 'active':
          $button = sprintf(
            '<button type="button" class="button dismiss"><span class="screen-reader-text">%1$s</span><span class="dashicons dashicons-hidden"></span></button>',
            esc_html__( 'Hide this item.', 'wordpress-seo' )
          );
          break;

        case 'dismissed':
          $button = sprintf(
            '<button type="button" class="button restore"><span class="screen-reader-text">%1$s</span><span class="dashicons yoast-svg-icon-eye"></span></button>',
            esc_html__( 'Show this item.', 'wordpress-seo' )
          );
          break;
      }

      $notifications .= sprintf(
        '<div class="yoast-notification-holder" id="%1$s" data-nonce="%2$s" data-json="%3$s">%4$s%5$s</div>',
        esc_attr( $notification->get_id() ),
        esc_attr( $notification->get_nonce() ),
        esc_attr( $notification->get_json() ),
        // This needs to be fixed in https://github.com/Yoast/wordpress-seo-premium/issues/2548.
        $notification,
        // Note: $button is properly escaped above.
        $button
      );
    }

    return $notifications;
  }
 

 View on GitHub View on Trac

Published: 8th June 2020 | Last updated: 25th January 2022

Primary Sidebar

Information

Function name: _yoast_display_notifications
Plugin ref: Yoast SEO
Version: 20.2.1
Sourcefile: admin/views/partial-notifications-template.php
File ref: admin/views/partial-notifications-template.php
API type: private
Deprecated?: No
API Letters: _,D,N,Y

Footer

Yoast SEO a2z
Yoast SEO a2z
WordPress SEO a2z
WordPress 6.1.1
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  wordpress-seo.wp-a2z.org
© Copyright Yoast SEO a2z 2017-2023. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites