如何在WordPress中为主题开发添加虚拟内容

It makes us very proud to hear that our WordPress tutorials inspire many readers to consider developing their own themes. For the users who just want to tweak their themes, we have a WordPress theme cheat sheet. However, some of our readers want to go beyond that and create their own themes from scratch. One such user recently asked us how to add dummy content in WordPress for theme development purposes. They were using a plugin to add dummy posts in WordPress, which is not an ideal solution. In this article we will show you how to add dummy content for theme development in WordPress using theme unit test data.

听到我们的WordPress教程启发了许多读者考虑开发自己的主题,这让我们感到非常自豪。 对于只想调整主题的用户,我们有一个WordPress主题备忘单 。 但是,我们的一些读者希望超越这些范围,从头开始创建自己的主题。 一位这样的用户最近问我们如何为主题开发目的在WordPress中添加虚拟内容。 他们使用插件在WordPress中添加虚拟帖子,这不是理想的解决方案。 在本文中,我们将向您展示如何使用主题单元测试数据为WordPress中的主题开发添加虚拟内容。

什么是WordPress主题单元测试数据? (What is WordPress Theme Unit Test Data?)

Theme unit test data is an XML data file that contains dummy content for WordPress theme development. It is used by WordPress theme developers to test their themes. It is also used by WordPress theme review team to test the themes for inclusion in WordPress theme directory.

主题单元测试数据是一个XML数据文件,其中包含用于WordPress主题开发的虚拟内容。 WordPress主题开发人员使用它来测试他们的主题。 WordPress主题审查团队还使用它来测试主题,以将其包含在WordPress主题目录中。

When creating a WordPress theme, there are a number of things that you need to consider such as images, links, widgets, post formats, galleries, lists, comments, page navigation, etc.

创建WordPress主题时,您需要考虑很多事情,例如图像,链接,小部件,帖子格式,画廊,列表,评论,页面导航等。

You need to make sure that your theme is ready for all these elements that a typical WordPress site is supposed to handle. Theme unit test data helps you test your themes for HTML tags, formatting, navigation menus, comments, widgets, etc. This allows you to create a theme that is truly compatible with WordPress. It is extremely important to test your theme with theme unit test data when you are planning to publicly release a theme.

您需要确保您的主题已准备好典型WordPress网站应该处理的所有这些元素。 主题单元测试数据可帮助您测试主题HTML标签,格式,导航菜单,注释,小部件等。这使您可以创建与WordPress真正兼容的主题。 当您计划公开发布主题时,使用主题单元测试数据测试主题非常重要。

Dummy content needed for theme development in WordPress
影片教学 (Video Tutorial)

演示地址

If you don’t like the video or need more instructions, then continue reading.

如果您不喜欢该视频或需要更多说明,请继续阅读。

使用WordPress主题单元测试数据添加虚拟内容 (Adding Dummy Content Using WordPress Theme Unit Test Data)

First you need to download the XML file for theme unit test data. Go to Tools » Import in your localhost development environment. On the Import screen, click on WordPress and a new popup window will appear asking you to install the WordPress importer plugin. After installing and activating the plugin, you will be redirected to the importer asking you to upload a WXR (.xml) file.

首先,您需要下载主题单元测试数据XML文件 。 转到工具»本地主机开发环境中导入 。 在“导入”屏幕上,单击WordPress,然后将出现一个新的弹出窗口,要求您安装WordPress导入程序插件。 安装并激活插件后,您将被重定向到导入程序,要求您上传WXR(.xml)文件。

Upload the XML file you downloaded earlier. On the next screen select the authors you want to import and download attachments. The importer will now import the data from XML file to WordPress. Once it is done, preview your site to make sure that all new content is there.

上载您先前下载的XML文件。 在下一个屏幕上,选择要导入和下载附件的作者。 导入器现在将把数据从XML文件导入到WordPress。 完成后,预览您的站点以确保所有新内容都在那里。

主题单元测试数据中包含什么? (What’s Included in Theme Unit Test Data?)

Everything that you would need to test your WordPress theme is packed in theme unit test data. It has categories, child categories, menu items, nested comments, pages, sub-pages, images of different sizes, image alignment, etc. There are lists, blockquotes, links, code, and other HTML tags that you should style in your themes. It is a comprehensive set of dummy data which is far better than using a dummy content generator plugin for WordPress.

测试WordPress主题所需的一切都包含在主题单元测试数据中。 它具有类别,子类别,菜单项,嵌套注释,页面,子页面,不同大小的图像,图像对齐方式等。您应在主题中设置样式,列表,块引用,链接,代码和其他HTML标签。 它是一组全面的虚拟数据,比使用WordPress的虚拟内容生成器插件要好得多。

We hope that this article helped you add dummy content for theme development in WordPress. If you have any questions or feedback, then please leave a comment below. Also don’t forget to follow us on Google+.

我们希望本文能帮助您为WordPress中的主题开发添加虚拟内容。 如果您有任何疑问或反馈,请在下面发表评论。 另外,不要忘记在Google+上关注我们。

翻译自: https://www.wpbeginner.com/wp-themes/how-to-add-dummy-content-for-theme-development-in-wordpress/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值