How to add demo content in WordPress


Description

Have you wanted to test features of WordPress, or even within a plugin or theme but needed demo or dummy content? Demo content includes posts with nearly every variety of formatting, including various types of blocks, images, and more. The Themes team leads the way with resources used when evaluating theme submissions to the repository.

Objectives

  • Beginners will identify and apply demo content.
  • Beginners can evaluate needed demo content.
  • Beginners can implement demo content when developing training materials and reference documentation.

Prerequisite Skills

Participants will get the most from this lesson if they have familiarity with:

  • Importing files into WordPress
  • Using WordPress as a content creator

Readiness Questions

  • Are you testing new features of plugins, themes, or WordPress itself?
  • Are you creating training or reference materials?

Materials Needed

Notes for the Presenter

  • An online connection is ideal for this lesson. Importing content depends upon an internet connection.
  • If you need to present this lesson offline, consider exporting an XML file (Tools > Export) in a local developer environment of WordPress and demonstrating on the same local environment how to import this file.

Lesson Outline

  • Talk about when you might want to have demo content. Ask what impression participants had when the demo content was not human readable language, but rather lorem ipsum text.
  • Discuss the many types of content types and layouts needed when demonstrating what WordPress can do.
  • Demonstrate how to save raw XML files from GitHub raw view in the browser.
  • Demonstrate how to use the WordPress Importer.
  • Discuss how the XML file is a set of directions for one website to import content hosted elsewhere. The XML file does not contain the data, but rather directions on how to fetch the data.

Exercises

Import Theme Unit Test Data

  • Download demo content
  • Import the demo content into your own site
  • Use the demo content to take screenshots

Assessment

Lorem Ipsum content is sufficient

  1. True
  2. False

Answer: 2. False

We can use FakerPress as needed

  1. True
  2. False

Answer: 2. True

Which teams maintain demo content?

  1. Themes
  2. Gutenberg
  3. Both

Answer: 3. Both

Additional Resources

Example Lesson

Whether you are testing features of a plugin, theme, or WordPress, or creating training material, you’ve likely needed demo or dummy content. It can save you considerable time, as you won’t need to create fake posts or gather images to test the feature.

Thankfully, the Themes team and Gutenberg contributors have created files for this purpose.

How to import content

Go to your local WordPress site at Tools > Import. You may need to install the importer plugin

Screenshot showing Tools > Import > WordPress > Install Now
Select the Install Now text

Select Run Importer

Select Run Importer
Screenshot: WordPress Admin Dashboard > Tools > Import > Choose File
Select Choose File and browse for where your file was stored

Import your file.

Screenshot: Import WordPress > Choose File > upload file and import
Select Upload file and import

You will be asked to choose how to assign authors from the original source.

Screenshot: Assign Authors, select Download and import file attachments
Select Download and import file attachments

Allow WordPress to run the import.

Successful import conformation message

Theme Unit Test Data

When reviewing themes submitted to the WordPress Themes directory, the Themes team needs a standard set of content that containts nearly every formatting scenario. That includes bulleted lists, gallery blocks, and so much more.

Download the XML file from https://raw.githubusercontent.com/WPTT/theme-test-data/master/theme-preview.xml. This is a set of directions prompting your site to import the content from an online repository.

Go to File > Save to save this page directly to your local computer.

Import your themeunittestdata.wordpress.xml file.

To view the freshly imported content, head to your Posts, Pages, Appearance > Navigation, or Media Library to review what has been imported.

Accessibility team has a version of this that specifically meets accessbility needs.

Gutenberg Test Data

The same steps as above can be used to import Gutenberg-specific test data. You can locate the Gutenberg XML file in its GitHub repository. This demo content is intended to commonly used blocks in conjunction with the Gutenberg plugin.

FakerPress

Creating demo content for custom post types, additional users, and areas outside the scope of the Theme Test Data can use the FakerPress plugin for additional options. FakerPress uses Lorem Ipsum content as it uses the Faker library. Lorem Ipsum content is less ideal, but acceptable for these other use cases.

Impressively, any demo content entered with this plugin can also be easily deleted with this plugin, unlike the Theme Test Data.

PlaceKitten

The Training team uses PlaceKitten for adding additional images, as well as Openverse and WordPress Photo Directory.

Lesson Wrap Up

💡 Follow with the Exercises and Assessment outlined above.