wp_dashboard_site_activity

函式
wp_dashboard_site_activity ( No parameters )

wp_dashboard_site_activity:這是一個WordPress函式,它生成“站點活動”儀表盤小工具,顯示最近站點事件的日誌,如新使用者註冊、文章和評論釋出以及外掛啟用。可以使用過濾器自定義該小工具以新增或刪除資訊。

活動小工具的回撥函式。

function wp_dashboard_site_activity() {

	echo '<div id="activity-widget">';

	$future_posts = wp_dashboard_recent_posts(
		array(
			'max'    => 5,
			'status' => 'future',
			'order'  => 'ASC',
			'title'  => __( 'Publishing Soon' ),
			'id'     => 'future-posts',
		)
	);
	$recent_posts = wp_dashboard_recent_posts(
		array(
			'max'    => 5,
			'status' => 'publish',
			'order'  => 'DESC',
			'title'  => __( 'Recently Published' ),
			'id'     => 'published-posts',
		)
	);

	$recent_comments = wp_dashboard_recent_comments();

	if ( ! $future_posts && ! $recent_posts && ! $recent_comments ) {
		echo '<div class="no-activity">';
		echo '<p>' . __( 'No activity yet!' ) . '</p>';
		echo '</div>';
	}

	echo '</div>';
}

常見問題

FAQs
檢視更多 >