This quick article will provide you with WordPress shortcode that'll render a Pen into your post or page. Using a shortcode rather than the default embed code makes sense for a number of reasons, not the least of which is that a shortcode makes the returned result more adaptable to the inevitable changes likely to take place in the future.
Using Tearable Cloth for our example, the shortcode of
[codepen id="http://codepen.io/dissimulate/pen/KrAwx" name="Tearable Cloth"] will return the following:
id (URL) and
name of the Pen is required. While the height can be altered, the width cannot (without additional formatting).
Copy and paste the WordPress function into your theme's
functions.php file or, if you sensibly have one installed, your custom functions plugin. You may optionally download and install our plugin from the bottom of of the page.
Used outside of WordPress, the following PHP function may be used.