do_action( 'rightnow_end' )

Fires at the end of the ‘At a Glance’ dashboard widget.


Description

Prior to 3.8.0, the widget was named ‘Right Now’.


Top ↑

Source

File: wp-admin/includes/dashboard.php. View all references

do_action( 'rightnow_end' );


Top ↑

Changelog

Changelog
Version Description
2.5.0 Introduced.

Top ↑

User Contributed Notes

  1. Skip to note 1 content
    Contributed by Razon Komar Pal

    Add something at the end of the ‘At a Glance’ dashboard widget.

    if ( ! function_exists( 'wpdocs_display_php_mysql_versions' ) ) {
    
    	add_action( 'rightnow_end', 'wpdocs_display_php_mysql_versions' );
    
    	/**
    	 * Displays the current server's PHP and MySQL versions right below the WordPress version
    	 * in the At a Glance [ Right Now ] dashboard widget.
    	 */
    	function wpdocs_display_php_mysql_versions() {
    		echo wp_kses(
    			sprintf(
    				__( '<p>You are running on <strong>PHP %1$s</strong> and <strong>MySQL %2$s</strong>.</p>', 'text_domain' ),
    				phpversion(),
    				$GLOBALS['wpdb']->db_version()
    			),
    			array(
    				'p' => array(),
    				'strong' => array(),
    			)
    		);
    	}
    }
  2. Skip to note 2 content
    Contributed by Codex

    Example:

    add_action('rightnow_end', 'add_recipe_counts');
    
    function add_recipe_counts() {
            if (!post_type_exists('recipes')) {
                 return;
            }
    
            $num_posts = wp_count_posts( 'recipes' );
            $num = number_format_i18n( $num_posts->publish );
            $text = _n( 'Recipe', 'Recipes', intval($num_posts->publish) );
            if ( current_user_can( 'edit_posts' ) ) {
                $num = "<a href='edit.php?post_type=recipes'>$num</a>";
                $text = "<a href='edit.php?post_type=recipes'>$text</a>";
            }
            echo '<tr>';
            echo '<td class="first b b-recipes">' . $num . '</td>';
            echo '<td class="t recipes">' . $text . '</td>';
            echo '</tr>';
    
            if ($num_posts->pending > 0) {
                $num = number_format_i18n( $num_posts->pending );
                $text = _n( 'Recipe Pending', 'Recipes Pending', intval($num_posts->pending) );
                if ( current_user_can( 'edit_posts' ) ) {
                    $num = "<a href='edit.php?post_status=pending&post_type=recipes'>$num</a>";
                    $text = "<a href='edit.php?post_status=pending&post_type=recipes'>$text</a>";
                }
                echo '<tr>';
                echo '<td class="first b b-recipes">' . $num . '</td>';
                echo '<td class="t recipes">' . $text . '</td>';
                echo '</tr>';
            }
    }

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