wordpress 自定义_如何在WordPress中添加自定义仪表板小部件

wordpress 自定义

There are tons of new themes coming out for WordPress every day, but none of them seems to utilize this feature. WordPress developers should add custom dashboard widget with support information. In this article we will show you how you can customize dashboard widgets in WordPress.

每天都有大量关于WordPress的新主题出现,但是似乎没有一个主题可以利用此功能。 WordPress开发人员应添加带有支持信息的自定义仪表板小部件。 在本文中,我们将向您展示如何在WordPress中自定义仪表板小部件。

Simply add this code to your theme’s functions.php file or a site-specific plugin.

只需将此代码添加到主题的functions.php文件或特定站点的插件中即可


add_action('wp_dashboard_setup', 'my_custom_dashboard_widgets');
 
function my_custom_dashboard_widgets() {
global $wp_meta_boxes;

wp_add_dashboard_widget('custom_help_widget', 'Theme Support', 'custom_dashboard_help');
}

function custom_dashboard_help() {
echo '<p>Welcome to Custom Blog Theme! Need help? Contact the developer <a href="mailto:yourusername@gmail.com">here</a>. For WordPress Tutorials visit: <a href="https://www.wpbeginner.com" target="_blank">WPBeginner</a></p>';
}

Remember to change the email and add other useful information.

记住要更改电子邮件并添加其他有用的信息。

This code can be very helpful when creating custom themes for clients.

为客户端创建自定义主题时,此代码可能非常有用。

Result:

结果:

Custom dashboard widget in WordPress

We hope this article helped you learn how to add custom dashboard widget in WordPress. You may also want to see our guide on how to remove unnecessary items from WordPress admin area.

我们希望本文能帮助您学习如何在WordPress中添加自定义仪表板小部件。 您可能还想查看有关如何从WordPress管理区域中删除不必要项目的指南。

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

如果您喜欢这篇文章,请订阅我们的YouTube频道 WordPress视频教程。 您也可以在TwitterFacebook上找到我们。

翻译自: https://www.wpbeginner.com/wp-themes/how-to-add-custom-dashboard-widgets-in-wordpress/

wordpress 自定义

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值