wordpress添加页面_如何在帖子和页面内容中添加WordPress小部件

wordpress添加页面

Widgets make it easy for users to simply drag and drop items into their WordPress site. Even though you can extend the power of default WordPress widgets, they are still limited to widget ready areas in your theme such as sidebars and footers. Wouldn’t it be nice if you could add widgets in your post or page content without writing a single line of code? Well, in this article, we will show you how to add WordPress widgets in posts and pages.

小部件使用户可以轻松地将项目拖放到其WordPress网站中。 即使您可以扩展默认WordPress小部件的功能 ,它们仍然限于主题中的小部件就绪区域,如侧边栏和页脚。 如果您可以在不编写一行代码的情况下在您的帖子或页面内容中添加小部件,那会很好吗? 好吧,在本文中,我们将向您展示如何在帖子和页面中添加WordPress小部件。

First thing you need to do is install and activate amr shortcode any widget. Once you activate the plugin, go to Appearance » Widgets. Next, drag and drop the widgets you want to display in your post or page into the Shortcodes sidebar.

您需要做的第一件事是安装并激活任何小部件的amr shortcode 。 激活插件后,转到外观»小部件 。 接下来,将要显示在帖子或页面中的小部件拖放到“简码”侧栏中。

Adding WorPress widgets in post or page content

Now those widgets are ready to be added to your content. Go to the post or page edit screen, and paste the following shortcode wherever you like in your content: [do_widget widgetname]. For example:

现在,这些小部件已准备好添加到您的内容中。 转到帖子或页面编辑屏幕,然后将以下短代码粘贴到内容中的任意位置:[do_widget窗口小部件名称]。 例如:

[do_widget calendar]

[do_widget calendar]

[do_widget pages]

[do_widget pages]

If the widget name has space in it, then you need to add widget name in quotes like this:

如果窗口小部件名称中有空格,则需要在引号中添加窗口小部件名称,如下所示:

[do_widget "recent posts"]

[do_widget "recent posts"]

That’s it. Now you can add WordPress widgets in your post and page content. If you want to add a little more style to your widgets, then you might want to check out our article on how to make WordPress widgets colorful and less boring. Most widgets have titles, but if you don’t want to display them, then use this tutorial on how to hide widget titles.

而已。 现在,您可以在帖子和页面内容中添加WordPress小部件。 如果您想为您的小部件添加更多样式,那么您可能想要查看我们的文章,该文章介绍了如何使WordPress小部件色彩丰富且乏味。 大多数窗口小部件都有标题,但是如果您不想显示它们,请使用本教程, 了解如何隐藏窗口小部件标题

故障排除 (Troubleshooting)

If the widget does not show up in your content, then you need to use the widget id in the shortcode. First, make sure that you have added the right widget in the shortcodes sidebar, and you have added the shortcode with the widget name in your post or page. Publish that post/page and open it in a new browser window. Add the following string at the end of the page URL like this:

如果窗口小部件未显示在您的内容中,则您需要使用简码中的窗口小部件ID。 首先,请确保已在shortcodes边栏中添加了正确的小部件,并且已在帖子或页面中添加了带有小部件名称的简码。 发布该帖子/页面,然后在新的浏览器窗口中打开它。 像这样在页面URL的末尾添加以下字符串:

http://www.example.com/page-title/?do_widget_debug

http://www.example.com/page-title/?do_widget_debug

It will show you debug information with widget IDs. Look for widget ids under the Shortcodes Sidebar.

它将显示带有小部件ID的调试信息。 在“ 简码”侧边栏下查找小部件ID。

We hope that this article helped you add widgets into your WordPress posts or pages. For questions and feedback please leave a comment or tweet at us by following @wpbeginner.

我们希望本文能帮助您将小部件添加到WordPress帖子或页面中。 对于问题和反馈,请通过关注@wpbeginner在我们这里发表评论或鸣叫。

翻译自: https://www.wpbeginner.com/plugins/how-to-add-wordpress-widgets-in-post-and-page-content/

wordpress添加页面

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值