WordPress: Padded Text Shortcode

This shortcode can be used to display blocks of text with a left/right margin. This pushes the text into the middle of the page/post, and makes it appear thinner than the rest of the content.

You can view an example of this shortcode in this post.

This shortcode will display text pushed into the middle like the example below:

The default margin on the text will be 50 pixels on both sides. This can be changed using the “padding” parameter like this:

This would push the text into the middle of the post/page with 250 pixels of space on the left/right side.

Article tags: center, centre, textbox, margins

Was this article helpful?

4 Comments

  1. Katy

    Hi Phil,

    Is there a way of making this effect work on all blog post text at once (even if there are photos scattered through the middle) or do we have to insert the code on every single paragraph?

    Thanks!

    1. Phil (pipdig)

      Hi Katy, sadly there wouldn’t be a way to do this across the whole site. The CSS required to resize the text needs to target specific paragraphs and not images, which is why there needs to be a shortcode to denote the sections manually.

      If you’d like to reduce the width of all blog post content (including images) you can do that from the “Layout Options” section of the Customizer.

  2. Adam

    Hi Phill, where do we find the full list of Pig Dig ‘Short Codes’ for your themes?

Leave a comment


The link to your website will be visible to support staff only. It will not be shown publicly.