Tag Archives: api

Securing the bacon

Later this year, we’ll be switching the site over to HTTPS only, instead of both HTTP and HTTPS as it is now.  If you use the site in a browser, this should not have any impact on you, but if you have an API that is using HTTP, you’ll want to get that updated to use HTTPS.

Posted in Blog | Tagged | Leave a comment

What does the cow say?

Props to @JBasoo for this little tidbit.

Posted in Blog | Tagged | Leave a comment

Now it’s even easier to bulk generate posts using WP-CLI

A few months ago, we published a blog posts on how to bulk generate posts using the WP-CLI and the Bacon Ipsum API.  Well, now it’s even faster and easier.

The latest release of the Any Ipsum plugin has WP-CLI support built-in to generate posts with filler content.  First, install and activate the plugin from the command-line.  By default, the plugin comes with Bacon Ipsum filler content.

wp plugin install any-ipsum --activate

Then, use the new any-ipsum generate-posts command to generate posts.  It defaults to ten posts, but you can pass in the number of posts to generate if you want more or fewer.

wp any-ipsum generate-posts

Boom, instant filler content.

wp-cli-any-ipsum-generate-posts

There are several options, so check out wp help any-ipsum generate-posts for a full list of what you can do with it.  Enjoy!

Posted in Blog | Tagged , , | Leave a comment

Updates to the API

We have some new updates to the Bacon Ipsum API:

New formats: ‘text’ and ‘html’ if you need responses in something other than the default JSON format.  Ex: https://baconipsum.com/api/?type=all-meat&start-with-lorem=1&format=html (Thanks to Shawn Hooper for new formats).

Ranges for paragraphs: Need to generate a random number of paragraphs?  We support that now, just put the range in the paras parameter, ex: paras=3-7  https://baconipsum.com/api/?type=all-meat&start-with-lorem=1&paras=3-7

These same updates have been made to the Any Ipsum WordPress plugin.

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

Meaty Social Politics

If you’re sick of the constant political drivel on Facebook, check out the Meaty Social Politics extension for Chrome that @WhiteyOmits whipped up.  It changes instances of ‘Obama’, ‘Romney’, ‘Election’, etc. into paragraphs of bacon ipsum via our API.

Meaty Social Politics

It also has a snazzy icon.  Well done sir!

Meaty Social Politics

P.S. I don’t care who you vote for, but you should still go vote.

Posted in Blog | Tagged | Leave a comment

API and jQuery Plugin updates

I’ve added support to the JSON API so you can generate one or more sentences of bacon ipsum rather than always generating paragraphs of text.   Just pass ‘sentences=x’ as a parameter.

For example: http://baconipsum.com/api/?type=meat-and-filler&sentences=1

The jQuery plugin has also been updated to support sentences.

All the source code goodness has also been posted to GitHub if you want to dig into it a little more.  Enjoy!

Posted in Blog | Tagged , , | Leave a comment

Git some bacon

Want to implement your own ‘insert-something-witty-here’ ipsum generator?  Then head on over to our GitHub repository and take a look at the code that runs baconipsum.com.  The BaconIpsumGenerator class is straight PHP code that can easily be modified to work as you see fit.  I’ll be refactoring this code a bit since the Make_Some_Meaty_Filler method is wrapping stuff in HTML and it really should return an array of paragraphs and sentences so the API code can handle it better.  It’s on my to-do list.

I also spent some time this weekend writing proper WordPress plugins for the site.  Previously, the home page’s form was hacked into the WP theme, and the API was just a standalone directory with a PHP page.  Now they’re both plugins and run based on WP actions & shortcodes.  It really shouldn’t affect what you see on the site at all, but it makes me feel warm & fuzzy to have it coded properly now.

Enjoy!

Posted in Blog | Tagged , | Leave a comment

jQuery Plugin

I whipped up a little Bacon Ipsum jQuery plugin that uses our API to generate some meaty goodness.  When you’re mocking up a design, now you can use this plugin in your HTML rather than static text.

You can reference the plugin from our server or download it and use it locally.
http://cdn.baconipsum.com/api/jquery-BaconIpsum.js

The easiest way to use it is just to call the method with no options.
$('#placeholder').BaconIpsum();

You can also pass in options.

$('#placeholder).BaconIpsum({ type:'all-meat', paras:5, start_with_lorem:false });
$('#placeholder).BaconIpsum({ type:'meat-and-filler', sentences:1, start_with_lorem:true });

  • type: either ‘all-meat’ or ‘meat-and-filler’
  • paras: number of paragraphs
  • sentences: number of sentences (this overrides paragraphs)
  • start_with_lorem: true or false to start the text with ‘Bacon ipsum dolor sit amet’
  • no_tags: true or false, pass true to not wrap the return value in <p> tags
  • set_value: sets the element value rather than appending

There’s a sample page on GitHub with some example code.

Posted in Blog | Tagged , , | 5 Comments

I don’t always test my code

I happy rolled out the API, did some basic testing and it all worked fine, but it was all from within the API’s own page.  Sure enough, external calls weren’t working.  I’ve done some tweaks to the PHP code and the sample code so it should all be working now.

Posted in Blog | Tagged , , | Leave a comment