How To Make Your WordPress Homepage Look Like A Real Magazine

Many WordPress magazine themes generate a homepage that attempts to surface as much content as possible.

But what if you want a homepage for your magazine that looks like, well, a magazine?

Here’s how to generate a magazine cover style homepage that will work across all devices. We are all familiar with the magazine cover look: the large background image, with strategically-placed, varying-sized headlines.

Whilst this approach obviously works in the offline world, it is rare to see such formatting in the online magazines which is surprising, especially given the continued rise in the use of tablets and handheld devices.

In this post, we are going to look at how to build a magazine cover for your own site that will work across all the platforms.

Screenshots of the magazine cover on a desktop, iPad and iPhone
Magazine covers are full of familiar visual cues

Note: The test data used for this post is provided by wptest.io.

Creating Your Own Magazine Cover Home Page

The solution is based on a combination of a plugin that overrides the template for generating the homepage and the support that virtually all themes provide for using a static page as the home page. The plugin also provides a shortcode for defining the headlines and adding custom CSS to the output.

Step 1 – Install The Plugin

The plugin is available on GitHub. Download the zip file and install as you would any other plugin and activate.

The plugin adds a new shortcode, headline (described in Step 2) and uses the template_include filter to override the template used for generating the homepage.

Step 2 – Create A Page

The first step is to create a page. The title is not used, so you can use something descriptive, such as “June Cover”.

You need to assign a feature image to the page as this is the image that is used as the cover image. Ensure the image you use is large enough (the example image is 900px x 1363px).

To add the headlines, the plugin provides a new shortcode, [headline], which takes the following attributes:

  • type : this gets added to the generated DIV element as a class, so be sure to use a class that is in your CSS. The default CSS provided by the plugin uses primary, secondary and standard.
  • id : this is an individual or list of comma separated post ids. An H2 element is created for each id, using the relevant post’s permalink and title.
  • image : determines whether the post’s feature image is displayed. Value is either yes or no with a default of no.
  • text : the post’s title can be overridden by specifying a title. You can specify a comma-separated list of titles if appropriate.

Here’s an example:

{code}

[headline type=”primary” id=”861″ text=”primary headline”]
[headline type=”secondary” id=”919″ image=”yes” text=”secondary headline”]
[headline type=”standard” id=”946,555,559″ text=”standard headline 1,standard headline2,standard headline 3″]

{/code}

This will result in the following HTML being generated:

{code}

<div class=”primary”><a href=”http://www.test.dev/title-with-markup/”><h2>primary headline</h2></a></div>
<div class=”secondary”><a href=”http://www.test.dev/markup-and-formatting/”><h2>secondary headline</h2><img width=”625″ height=”434″ src=”http://www.test.dev/wp-content/uploads/2013/01/man-of-steel2.jpg” class=”attachment-large wp-post-image” alt=”man-of-steel2″ /></a></div>
<div class=”standard”><a href=”http://www.test.dev/post-format-standard/”><h2>standard headline 1</h2></a><a href=”http://www.test.dev/post-format-gallery/”><h2>standard headline2</h2></a><a href=”http://www.test.dev/post-format-aside/”><h2>standard headline 3</h2></a></div>

{/code}

Add as many headlines as you need and publish the page.

Step 3 – Assign Your New Page As A Static Homepage

Go to Settings > Reading and select a static page in the Front page displays setting. Choose your new page from the Front page dropdown list.

Alternatively, you can go to Appearance > Customize and select the same settings under Static Front Page. The advantage of doing it this way is that you will get an instant preview.

Once set, navigate to the front page of your site.

Screesnhot fo the demo site running on the iOS simulator
For the right sort of site, magazine cover style homepages can be high impact

Step 4 – Customize Your CSS

Depending on your background image and the length of your headlines you’ll likely need to customize the CSS to get the positioning you want. You may even find that you need to customize from cover to cover.

There are a couple of ways to customize the CSS:

  1. Custom Field – create a custom field on the page called custom_css and place the CSS in the field value. If the plugin finds this custom field for the page then it will wrap the value in style tags and insert it into the HTML. Using the custom field allows you to keep the custom css in tact.
  2. Edit style.css – you can directly edit the CSS file in the plugin’s template directory.

Custom CSS plugins won’t generally work, as the template is minimal and doesn’t support the common actions and filters such as wp_head and wp_footer.

The background image is actually added in the cover.php template. It adds the following CSS statement to the header:

{code}

html {
background: url(‘page thumbnail url’) no-repeat center center fixed;
background-size: cover;
}

{/code}

This simple technique ensures that the image is always fullscreen across all platforms.

What To Customize?

The CSS is not difficult to override. As mentioned above, each of the headline shortcodes is converted to a DIV element with the class defined by the type attribute, containing a hyperlinked H2 for each post.

To position the DIV is simply a matter using absolute positioning and setting the appropriate top, right, bottom and left values. To override the look of the hyperlinked H2, use a CSS clause of type a h2, for example:

{code}

.primary {
position: absolute;
bottom: 3%;
left: 1%;
text-transform: uppercase;
padding: 0;
margin: 0;
width: 45%;
}

.primary a h2 {
font-size: 400%;
}

{/code}

The only id in the CSS is for #site-title. The title of your WordPress site is automatically pulled out and put at the top of the screen.

If you look at the style.css file, you’ll see that I’ve kept things pretty simple and used % wherever possible, including for font-size. This is a slightly lazy approach but does mean that the page looks the same across desktop, iPad and iPhone without too much extra effort.

You can also override the background image in the custom css (it is inserted last). Depending on the image you might want to change how the image is displayed on a tablet or smartphone or adjust it for orientation.

Magazine-ify Your Homepage!

Given that it’s virtually impossible to come up with a definitive stylesheet to cater for all situations and that even your own covers may vary from edition to edition, I haven’t worried too much about the CSS.

Most likely you (or your designer) will develop much better CSS than I have and you may also want to tweak the template itself, cover.php.

Hopefully, though, this has given you the inspiration and the “leg-up” to start producing your own magazine cover style homepage.