Have you ever landed on a website for the very first time which is all the same color?
How hard is it to find the most important content on that page?
On your own site you know where everything is but put yourself in your readers shows for a minute.
Around 80% of visitors to your site are new.
They have never seen your site before and when they leave, most will never come back.
So make it easy for them and more will come back.
Invalid Short Codes & CSS
Highlight your most important: content, links and calls to action using colored boxes.
But this can cause a massive problem down the track for you.
The reason for this is most themes include this feature built into the core files.
When you change themes, you end up with invalid shortcodes, css code or html that doesn’t work.
This can be a nightmare to remove manually.
Invalid code will also look ugly, unprofessional and worst of all, the content you highlighted to grab your readers attention, is no longer highlighted.
This is called theme lock and sometimes used to try and lock you into staying with the same theme developer.
3 Ways to Make Colored Boxes
The solution to this is to either:
- Install a plugin with shortcodes which moves with you from theme to theme.
- Using CSS only – Insert a small code block into your child themes css file which works on all themes.
- Using CSS and php to create shortcodes for colored boxes.
Using Pure CSS Code
Here’s some code which you can easily paste into your child themes style.css file.
.alert {
background-color: #eee;
border: 1px solid #ddd;
display: block;
padding: 10px;
}
You can easily edit this code to change:
- The background color – background: #eee;
- The border color – border: 1px solid #ddd;
- The border thickness – 1px solid
- The padding between your text and the border – padding: 10px;
- Create different types of boxes ( .alert, .note, .info) – .alert
Once you’ve created different colored boxes and styled them, simply wrap your content using this code in your HTML editor.
If you want 3 types of boxes, simply use the code block above and name them:
- .note – Use this to make a note box
- .alert – Use this to make an alert box
- .info – Use this to create an info box
Different themes use different code for displaying boxes
- Woo themes uses shortcodes built into the framework
- Genesis doesn’t offer any code built into the core files so you’ll need to install a plugin or use the code above.
- Thesis uses this code which won’t work in Genesis or StudioPress themes
Creating Shortcodes for Boxes
You can also create great looking boxes using shortcodes which won’t break when you move themes.
Difference Between Shortcodes & CSS
Shortcodes will enable you to include content with paragraphs within your colored boxes.
Pure CSS will only allow you to wrap the content within one paragraph.
Changing Themes Without Breaking Code
One of the big advantages of adding the code above is that you may find your old boxes start working again.
This depends on which theme you where using previously but in my case it worked after moving from Thesis.
If you do use code like this which is flexible, you won’t suffer any problems when you change themes.
How about yourself, what do you use to draw attention to your most important content?
Leave a Reply
You must be logged in to post a comment.