How to use static blocks

What are static blocks?

Sometimes we want to display the same content on several pages. Later when we want to change this content, we need to change it in all those different places. There should be a better way, right? Here is where static blocks come in handy. Static blocks are pieces of reusable content, which can be displayed using a shortcode or widget.

 

Static Block use case example

Let's create a reusable content with icons that link to our profiles on social networks. In this example we will create an icon with a link to Twitter, Facebook and Google+.

1. Create a static block

1. Create a new static block by navigating to Static Blocks -> Add New
2. Switch to Page Builder view, click add Widget and choose (OrionThemes) Icon widget.
3. Add social icons and link them to your social network accounts.

This is how the preview of our new static block looks like:

It is important to know that when we'll use the static block on other pages or widget areas, the title of static block will not display, just the content inside it. The title serves just for content organisation purposes.

2. Static Block widget

Let's say we want to use the static block in the footer area. We will add it to the bottom of first column.
Here is how the footer looks like now:

Now let's navigate to Appearance -> Widgets and add (OrionThemes) Static blocks to Footer 1 widget. In the Static blocks widget, you can now select the previously created static block.

And here is how the footer looks like now:

3. Using Static Block shortcodes

Shortcodes are an addition to the Static block Widget. With the shortcodes you can use Static Blocks also on pages and posts, where you don't use page builder.

After you've created a static block, you will see a shortcode below the content:

You can see the same shortcode on the Static Block -> All items link:

 Just copy the short code and paste it anywhere you like and the content of this static block will display there. 

Notice: Shortcode support isn't yet available in all of the themes, it will be included with the next update.

 

Was this article useful? 4

Orion

Living the WordPress Magic.