我是 WordPress 的初学者,我发现了很多用于创建小部件的插件,但我想创建一个自定义文本和 RSS 小部件,就像每个 WordPress 安装附带的小部件一样。它允许用户向他们的 WordPress 网站添加文本、视频、图像、自定义列表等。我应该为此做什么。
最佳答案
//Put This code in themes -> function.php
register_sidebar( array(
'id' => 'custom-widget',
'name' => __( 'Custom Widget', $text_domain ),
'description' => __( 'This is custom widget.', $text_domain ),
));
//After place code to function.php you can see your widget in your dashboard widget.
//Place This code where you display your widget
if (function_exists( 'dynamic_sidebar' ) &&
dynamic_sidebar( sprintf( 'custom-widget', $i ) )
)
关于javascript - 如何创建您自己的基本 WordPress 小部件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39805111/