PHP 将小部件添加到wordpress管理仪表板

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP 将小部件添加到wordpress管理仪表板相关的知识,希望对你有一定的参考价值。

add_action('wp_dashboard_setup', 'custom_dashboard_widgets');

function custom_dashboard_widgets(){
	//first parameter is the ID of the widget (the div holding the widget will have that ID)
	//second parameter is title (shown in the header of the widget) -> see picture bellow
	//third parameter is the function name we are calling to get the content of our widget
	wp_add_dashboard_widget('my_custom_widget_id', 'My Widget Title', 'my_custom_widget');
}

function my_custom_widget() {
	//the content of our custom widget
	echo '<p>The content of the widget goes here.</p>';
}

以上是关于PHP 将小部件添加到wordpress管理仪表板的主要内容,如果未能解决你的问题,请参考以下文章