WordPress: Save time by using templates

One thing I hate about writing posts is recreating the same layout and style for each post. It’s just time consuming and sometimes I forget what I did to get that specific style, so I have to either cut and paste from an old post and edit all the content or open a second window with an old post and cut and paste the necessary code. Whew! Tired just talking about it.

Luckily, there’s a plugin that let’s you create content templates and you can get it here: TinyMCE Templates

Or just hop on over to Plugins -> Add New, and do a search for “TinyMCE Templates”. Install and activate.

You’ll now get a “Template” menu item in your admin menu. Click that and name and add your first template. Now, when you create a new post, you’ll have a button to “Insert Template”. Choose the one that you just created and it’ll add that code into your editing window. Voila!

CSS: nth-of-type()

When you need to select the nth number of an element. This differs from nth-child because nth-child will select the nth child of a parent whereas nth-of-type will select the nth of the type of element.

Take this piece of code for example:

<div class="parent">
  <h2>Hi There</h2>
  <p>1</p>
  <p>2</p>
</div>

 

nth-child will select <p>1</p>

p:nth-child(2) {
  color: red;
}

 

nth-of-type will select <p>2</p>

p:nth-of-type(2) {
  color: red;
}