Continuing with the ongoing series of posts on shortcode, here’s some examples of how you can fancy up your posts – or use styled elements in a post to emulate a ‘Squeeze Page’.
A Squeeze Page is one of those long pages full of fancy images, videos and testimonials that are designed to achieve one of two things – squeeze an email out of you, or sell you something. There are a lot of squeeze page templates you can buy, but quite often you can reproduce the elements of a squeeze page with simple shortcode. I’ll be releasing a product soon that’ll permit you to create a WordPress based squeeze page with shortcode. Sign up to my mailing list to be notified when this product is available for download.
Here are a few ideas for you to play with that will style your page a cut above the rest.
Fancy <blockquote>
Most WordPress themes offer a simple <blockquote> to fulfill a broad purpose and they aren’t overly content specific. Sometimes it’s important to jazz up these elements for enhanced quotes or testimonials.
First, this styled blockquote.
~ Marty, Internoetics.com
The code. Cut and paste the following into your theme’s functions.php file.
function my_quote($atts, $content = null) {
extract(shortcode_atts(array(
'textcolor' => '#000000',
'bgcolor' => '#fefef1',
'bordercolor' => '#e5e5e5',
'border' => '1px',
'bordertype' => 'solid',
'from' => ''
), $atts));
// $byline = "<p align=\"right\"><strong><em>~ $from</em></strong></p>";
return "<div style=\"background: url('images/bg-quote-home.png') $bgcolor no-repeat left top; color: $textcolor; border: $border solid $bordercolor; font-size: 1em; font-style: italic; margin: 10px auto; padding: 10px 20px 1px 60px; width: 420px\">$content<br><br><p align=\"right\"><strong><em>~ $from</em></strong></p></div>";
}
add_shortcode('myquote','my_quote');
Usage:
[myquote from=”Marty, Internoetics.com”]
You will require this image and you’ll have to update the image link in the above code. You will have to resize it in width to match up with the width of your blockquote. If you have problems – let me know.
Quotes as Testimonials
The importance of referenced testimonials cannot be stressed enough when it comes to selling products or services. A sample testimonial block is provided below.

~ Marty, http://www.internoetics.com
The code. Cut and paste the following into your theme’s functions.php file.
function my_testimonial($atts, $content = null) {
extract(shortcode_atts(array(
'img' => '',
'name' => '',
'website' => '',
'alt' => 'testimonial'
), $atts));
if (isset($img)) {
$img_style = "<p style=\"float: right; padding: 6px;\"><img src=\"$img\" height=\"60px\" width=\"60\" border=\"0\" alt=\"$alt\" /></a></p>";
}
if ($name != "") {
$byline = "<br><p align=\"right\"><strong><em>~ $name, <a href=\"$website\">$website</a></em></strong></p>";
}
return "<div style=\"color: #666; padding: 5px 0 5px 26px; font-size: 11px; background: url(http://www.internoetics.com/images/testimonials/blockquote.gif) no-repeat 5px 5px; border-top: 1px dotted; border-bottom: 1px dotted; margin: 10px 0;\">$img_style <i>$content</i> $byline</div>";
}
add_shortcode('testimonial','my_testimonial');
Usage:
[testimonial img=”http://www.internoetics.com/images/testimonials/marty-testimonial.jpg” name=”Marty” website=”http://www.internoetics.com” alt=Marty”]Content in here[/testimonial]
Styling your lists
Lists can be boring. Again, WordPress designers style lists to cater for the majority of posts that you’re likely to create. Sometimes, it’s important to give them some flare. Keep in mind that this is just one single example on how to style your unordered lists. I’ve got another post scheduled that will show you how to style them in countless different ways.
Examples:
- This is item one
- This is item two
- This is item three
- This is item one
- This is item two
- This is item three
Paste the following into your functions.php file.
function my_ticklist($atts, $content = null) {
return '<div class="ticklist">'.$content.'</div>';
}
add_shortcode('ticklist', 'my_ticklist');
function my_crosslist($atts, $content = null) {
return '<div class="crosslist">'.$content.'</div>';
}
add_shortcode('crosslist', 'my_crosslist');
… and paste the following into your css file.
.crosslist ul {
margin-left:50px;
list-style:none!important
}
.crosslist ul li{
list-style-type: none;
padding:5px 5px 5px 30px;
background: #fff url("http://www.YourDomain.com/images/cross.png") no-repeat center left;
}
.ticklist ul {
margin-left:50px;
list-style:none!important
}
.ticklist ul li{
list-style-type: none;
padding:5px 5px 5px 30px;
background: #fff url("http://www.YourDomain.com/images/tick.png") no-repeat center left;
}
Usage
[ticklist]<ul>
<li>This is item one</li>
<li>This is item two</li>
<li>This is item three</li>
</ul>[/ticklist]
Note that we have simple wrapped the shortcode around your existing list. Download the images used here.
More coming soon…
I hope this has helped you with some ideas. If there’s anything specific that you want, please let me know.
|
|
Download: Images used in this post (Shortcode 4) |
If you liked this article, you may also like:


“If there’s anything specific that you want, please let me know.”
Hello Marty, I’m back again with a special question: I like to have a shortcode (look at the bottom of http://meteoritemen.com/media.htm)
left: a thumb
right: a title, under the title some description like image size, file format, a download link of the picture in that size
Can you write about such a solution?
Thanks in advance, Ramona
Hi Ramona. I’ve just sent you an email. This is really more of a design solution but I could very quickly write a shortcode solution for you. I could see where it would come in handy. I’ll be out for a few days so you’ll have to give me some time!
Thanks for this post, it has helped a great deal. However, when I try to use the shortcode in a text widget, it does not work. Is there a way to fix this?
Hi Clint. You’ll need to all the following line into your theme’s functions.php file (the same location you copied the other code).
add_filter('widget_text', 'do_shortcode');Let me know if you have problems.
Hi there- great testimonial! I’m trying to use the quotes as widgets short code- everything seems to be working exept for my images. For some reason, the images aren’t showing up. When I view the image location, a wierd string of characters is being appended at the end of the image url (which I didn’t put in the code) It is: %E2%80%9D What would be causing that?
E2 80 9D is the UTF-8 encoding for the right double quotes (“) [ Here's a reference for you: http://www.tachyonsoft.com/uc0020.htm ]. Make sure that the image URL has quote marks at both ends (perhaps you could replace them in notepad to ensure that they copy as text). Let me know if that’s the problem.
I’ve just noticed that the list style shortcode is broken (for reasons that aren’t immediately obvious). I’ll fix it soon.
Edit (4.15pm): Now fixed.
Hi, Marty, i tryed to enable the option Fancy blockquote on my function.php file, but the only one thing I get was my web site go down. Obviously, I did it an a wrong way because I don’t know where exactly I have to place the code. So I was wondering if you can give some step by step guide to do it.
I am using a WordPress template (3.3.1 version) and WP Clear Theme. Could you help me in this matter, please? Thank you so much in advance.
It’s probably too late, but I’ll be able to post some screenshots etc in a few days. I’m busy with a project at the moment that is due to last another three weeks. I’ve actually banned myself from using a computer to ensure I get ‘real’ work done. Sorry I couldn’t help you sooner. Three days!
It is ok, Marty. I would like to solve this issue soon, but I can perfectly wait for you to end your project. Actually, I am starting my online magazine and doing all initial adjustments in these days, so three more weeks is not a problem for me. Your blog is really very instructive.Thank you in advanced for all your help. Best regards.
this is really fantastic solution for designing a nice testimonial page. thanks for sharing.