Bulk generating WordPress posts with filler content using WP-CLI and the Bacon Ipsum API

I recently attended WordCamp Miami and Shawn Hooper gave an excellent talk on using the WordPress command-line interface (WP-CLI) to manage your WordPress install.  One of the items he covered was bulk generating posts so you have some initial content to use when developing a new theme or other functionality.  Check out all the slides on his site.

Using the “wp post generate” command, you can have WordPress bulk generate a specific number of posts.  By default, these posts are empty, but by including a curl command to the Bacon Ipsum API, you can have the posts automatically filled with Bacon Ipsum filler content.

curl "https://baconipsum.com/api/?type=meat-and-filler&paras=5&format=html" | wp post generate --count=50 --post_content

The one drawback to this method is the results of the API call are used for every post, so each post has the same filler content.  However, using a “for” loop in the terminal, we can generate unique filler content for each post.  It takes longer to generate the posts, but you will get unique content.  For example, this will generate five posts with unique content.

for n in {1..5}; do curl "https://baconipsum.com/api/?type=all-meat&paras=5&format=html" | wp post generate --count=1 --post_content; done

You’ll get output that looks something like this.

bacon-ipsum-api-wp-cli-bulk-generate-posts

I’m also thinking of adding range values or a ‘random’ parameter to the API so you can get content of varying lengths, such as 1-5 paragraphs instead of always a fixed length.

FYI, Shawn also contributed code to the Any Ipsum plugin at the beginning of WordCamp Miami to allow the API to return text or HTML instead of just JSON so he could use it in his talk.  It’s really great to be able to incorporate a new feature right away and many thanks to Shawn for the new features.

 

Posted in Blog | 2 Comments

Now powered by Any Ipsum

Last month, we released the Any Ipsum WordPress plugin for people that were interested in creating their own custom ipsum generator.

Since I firmly believe in dogfooding, the Bacon Ipsum generator is now completely powered by this plugin as of today!

Posted in Blog | Tagged , | Leave a comment

Any Ipsum

Ever since Bacon Ipsum launched back in June 2011, a huge number of alternative ipsum generators have popped up on the net.  I’m not sure if this site was the catalyst for this or not, but I like to think so.   🙂

I often see “Someone should make an X ipsum…” with X being something that doesn’t exist yet.  If you weren’t a developer, making your own ipsum generator could be difficult, but no more.

Today we released Any Ipsum, a WordPress plugin that will let you create your own alternative custom ipsum generator.  As an example, I created a Meme Ipsum generator in just a few minutes, and eventually we’ll be converting Bacon Ipsum over to use this new plugin.  It has all the features our site does: front-end HTML form, JSON API, oEmbed, etc.

So if you have an idea for the next big ipsum, give it a try!  By default, it installs bacon ipsum (hey, I’m rather fond of it), but it’s very easy to customize it to your liking.

Big thanks to Sarah Martin for the new logo:

any-ipsum-banner-772x250

screenshot-1

screenshot-2 screenshot-3

Posted in Blog | Tagged , | Leave a comment

Bacon Reader

Google is using some Bacon Ipsum for their design guidelines, down in the Feed Reader sample.

components-cards-usage-card_noa_large_mdpi

Posted in Blog | Tagged , , | Leave a comment

SSL on Bacon Mockup

SSL has been enabled for images on baconmockup in case you need that sort of thing:  https://baconmockup.com/300/200

Posted in Blog | Leave a comment

Fun bacon

Posted in Blog | Tagged | Leave a comment

Chromed Bacon

In an effort to give you as many ways as possible to make your filler text even meatier, we whipped up a simple Chrome App for generating bacon ipsum text.  Source is also available on GitHub.

bacon-ipsum-chrome-app-screenshot-01

Posted in Blog | Tagged , , | 2 Comments

A speedier baconmockup

I recently moved baconmockup over to an Amazon EC2 micro instance, mostly to improve the performance over the shared hosting it was on.  It also gives me a chance to get reacquainted with the LAMP stack (Ubuntu in this case), EC2 and the whole Amazon Web Services platform.

Enjoy your speedier meaty placeholder images!

Posted in Blog | Tagged | Leave a comment

Alfred

If you use Alfred, now there is a Bacon Ipsum workflow.

Posted in Blog | Tagged | Leave a comment

Bacon-wrapped shrimp

A perfect SXSW compliment to Bacon Ipsum

image

Posted in Blog | Tagged | Leave a comment