WordPress

How To Build a Two-Column Single Post Header with the WordPress Site Editor – WP Tavern

One of many options I appreciated about Automattic’s Archeo theme that I reviewed earlier this week was its split-screen single submit header. I cherished that an creator was doing just a little one thing totally different with the Featured Picture block, giving customers some selection.

The design was easy. It’s a two-column part with a picture on the precise and the submit title and date on the left.

Single post title on a WordPress post page view.  The date and title are on the left.  The featured image is on the right.
Break up-screen submit title and picture.

It jogged my memory to mud off one of many untold numbers of “concepts” folders on my pc. I knew I had constructed one thing comparable final yr. I merely wanted to search out it.

I lastly stumbled upon it after a little bit of rummaging — I actually need to learn to title issues to make them simpler to search out:

Single blog post with a featured image on the right and post title, author, date, comments link, and excerpt on the left.
Outdated cut up submit header design concept.

My method to the issue was totally different, and I bear in mind why it went to the scrap-heap. It used the Media & Textual content block as a substitute of Columns. Then, and that is nonetheless the case, it’s unattainable to make use of the Featured Picture inside Media & Textual content.

The Columns block is an honest second selection, however it stacks in another way on cell views, with the primary column all the time touchdown on prime. The picture takes priority when utilizing the Media & Textual content block, no matter its horizontal place on desktop views.

There’s an open ticket to make use of the submit’s featured picture within the Media & Text block. There’s a comparable ticket for utilizing it within a Cover. Each can be solved by addressing a problem that will have farther attain by permitting generic blocks to utilize site or post metadata.

Not less than for now, we should work with the instruments now we have.

For this entry within the Building with Blocks sequence, I’ll stroll you thru modifying Twenty Twenty-Two’s single submit template to create the same structure.

It’s exhausting for some individuals to visualise the outcome with out the submit knowledge. As proven within the following screenshot, the editor has placeholders:

WordPress site editor showing the single post view with a split-screen header.
Editor view of split-screen submit header.

Nonetheless, these placeholders can be remodeled on the entrance finish. How do we all know that what we see there’ll translate appropriately and prove like the next?

Entrance-end view of single submit with split-screen header.

Even I battle with this visualization at occasions. The placeholders used for Submit* blocks don’t supply me sufficient direct suggestions, so I typically refresh an instance submit on the entrance finish as I construct layouts like this. I needed to notice this in case it disorients and even throws anybody else off. It’s OK to save lots of and test your work on the entrance finish as you undergo this.

Facet word: I’d like to see a plugin that provides dummy submit knowledge as a substitute of the default placeholders.

Step 1: Choosing the Single Submit Template

WordPress site editor with Templates screen open.  The Single Post option is selected.
Choose the Single Submit template.

To make this structure change for all single posts, you have to go to the positioning editor through Look > Editor within the admin. Choose the WordPress brand/icon within the prime left nook to open the slide-out panel. From there, click on on the Templates hyperlink. The subsequent display ought to show a listing of editable templates. Choose “Single Submit.”

If you happen to want to make this an elective template, it is best to construct this from the template editor. The method is analogous, however the UI does have some variations.

Step 2: Adjusting Web site Header (Optionally available)

WordPress site editor with the Header template's inner Row block select.  Adjustments are being made to the alignment.
Adjusting header Row blocks’ alignment and padding.

Twenty Twenty-Two’s header doesn’t work nicely for the kind of structure that we’re constructing. It has a ton of padding on the backside, and its width is restricted. It would be best to make a couple of modifications for a extra ultimate design. Be aware that this can change the header throughout all the web site until you reserve it as a separate template half. This step is elective, however the remaining outcome will look higher.

Within the Header space of the editor, choose the Row block that holds the Web site Title and Navigation blocks. From the toolbar, choose the “Full width” alignment choice. Within the block sidebar panel on the precise, set the “Padding” choice to 2rem or a price of your desire.

Step 3: Creating Columns

WordPress site editor with a Post Title and Post Featured Image block selected. The transformation drop-down is selected with the Columns option highlighted.
Wrapping the Submit Title and Submit Featured Picture blocks in columns.

As a result of Twenty Twenty-Two already has the Submit Title and Submit Featured Picture blocks grouped collectively, there isn’t a want to begin from scratch right here. Choose each along with your mouse or keyboard, click on the “Remodel To” button within the toolbar, and select the Columns choice.

If working from a theme with a distinct structure, you’ll be able to manually add a Columns block with a 50/50 setting and insert the Submit Title and Submit Featured Picture blocks within the two columns.

Step 4: Designing Columns

Adjusting alignment, colours, and padding of Columns block.

We have now gotten a number of the boring structure stuff out of the best way. Now, you can begin including your personal model of artistry to this factor. I selected a black background and white textual content for the Columns block. Nonetheless, be happy so as to add no matter colours you need. Possibly even check out the border choices to combine it up.

Now, again to boring structure changes.

For this structure to work, there are two modifications it is best to make to the Columns block. First, choose the “Full width” alignment from the toolbar.

Then, change the “Padding” choice within the block sidebar to 0. Zeroing this out permits the featured picture to stretch to the sting. This isn’t a tough requirement in order for you just a little area round it.

Step 5: Title Group

WordPress site editor with a Group block selected around the Post Title block.
Grouping the Submit Title block and including some padding.

As a result of we zeroed out the padding within the earlier step, the Submit Title block will now butt towards the aspect of the structure. Textual content all the time wants room to breathe in design, so we have to repair this downside now we have created for ourselves.

There are two methods of going about this. The primary is to easily add padding to the Column block that the Submit Title is in. This could work wonderful, however WordPress doesn’t deal with this nicely (it doesn’t use box-sizing: border-box for Column blocks). If you happen to add padding right here, it’s going to make the left aspect wider than the precise. Sadly, it is a little quirk that creates additional work.

The best choice is to pick the Submit Title and rework it right into a Group. Then, discover the “Padding” management within the sidebar and alter it to 2rem or your most popular worth.

Some themes could appropriate the column-padding difficulty, so give the primary choice a shot if utilizing one thing aside from Twenty Twenty-Two.

Step 6: Adjusting Featured Picture

WordPress site editor with the Post Featured Image block selected.  In the design tools sidebar, the margin option is set to 0.
Eradicating margin from Submit Featured Picture block.

Neither WordPress nor Twenty Twenty-Two provides any default margin dealing with for the Submit Featured Picture block. The <determine> wrapping ingredient will fall again to the browser’s default (browsers typically add some margin to the highest and backside).

To make sure that the picture doesn’t have additional spacing, choose it within the editor, discover the “Margin” setting within the sidebar, and set it to 0.

Step 7: Have Enjoyable

WordPress site editor showing the single post view with a split-screen header.
Custom-made split-screen submit header.

The inspiration of the structure is in place now. Adjusting paddings, margins, and comparable settings is the large mountain you have to conquer to do a number of the actually cool stuff that’s potential. I don’t need to restrict people with the remainder of the design and would love for everybody to place their very own spin on it.

I modified the vertical alignment on the Columns block to the “Align backside” setting for my structure. Above the Submit Title, I added a Row with the Submit Creator Identify, Submit Date, and Submit Classes blocks. I additionally eliminated the Separator that Twenty Twenty-Two provides earlier than the content material.

Please share customizations you made within the feedback when you adopted together with this tutorial.

Leave a Reply

Your email address will not be published. Required fields are marked *