I sometimes need custom coding when I write blog posts. For example, the Thesis theme has two built-in paragraph styles:
alert. To use them I need to add
class="alert" to the paragraph tag. Here’s what they do:
This is a Note.
This is an Alert.
If I include a Google map, using the WP Geo plugin, then I need to use the short tag:
[wp_geo_map] in the body of the Post.
For example, I just listened to a fascinating interview about Pitch Lake and the organisms that live in it:
Your first mental picture of a lake in a tropical resort island like Trinidad and Tobago probably couldn’t be more different from Pitch Lake. Pitch Lake is a bubbling, stinking, sticky deposit of degraded petroleum that’s been mined for more than a century for road-asphalt. It turns out, though, that Pitch Lake is also alive.
Hmmm … Trinidad and Tobago? … ah.
Add custom code to the Format menu
Rather than typing out these extra bits of code every time I need them I insert them from the Mars Edit Format menu. It’s easy to edit items in that menu:
- Go to the
Formatmenu in the menu bar.
- Click on
Markup Macroswindow appears.
- Select an item beneath which you want your new custom code to appear (or add it anywhere and drag it into position later).
- Click the
+symbol at bottom left of the window. The macro edit window appears.
- Enter a name, and then any custom coding you require.
OKto save the macro.
Tips for macros
Name is just for your reference. Make it meaningful to you. Sometimes I use the custom code itself, at other times I use a ‘shorthand’, such as
Click in the
Shortcut field and press a combination of keys to set that combo as a quick way to use the custom code. In the first screenshot you can see that
Command (⌘) Shift (⇧) A lets me quickly Paste a Link.
Placeholder such as
Selected Text to wrap your custom code around text you’ve already typed.
Use the macros
To use a macro, first make sure you have selected where it should appear, then:
- choose it from the
Formatmenu in the Menu Bar
- choose it from the
Formatdropdown menu in the ToolBar
- type the custom keystroke you selected.
A map showing Trinidad and Tobago
Pitch Lake is near La Brea (Thanks Wikipedia).