[Shortcode] Examples 4 – Quotes, Testimonials & Lists

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.

This quote box can be inserted into any post by using the shortcode of [myquote]. You should probably limit the number of quote boxes you use on your website to one or two. Readers can get use to consistency and are often confused by page presentations that changes regularly.

~ 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.

testimonial

In promotion and advertising, a testimonial consists of a written or spoken statement, sometimes from a person figure, sometimes from a private citizen, extolling the virtue of some product or service. It’s always good to link back to the person making the statement as a form of transparency. Including an image gives the statement a personal touch.

~ 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.

First Name:
Your Email Address:
 




Download: Images used in this post (Shortcode 4)
Description: Images used in this shortcode post
Author:Marty
Category: Images
Date: January 13, 2011



If you liked this article, you may also like:

  1. Display Testimonials or Quotes from an XML File with WordPress Shortcode
  2. [Shortcode] Examples [2]
  3. [Shortcode] examples [3] – Text Boxes
  4. Expandable ‘blind’ with shortcode
  5. [Shortcode] Examples [1]
About Marty

is a passionate web developer from Sydney, Australia. He owns about 600 websites and makes a healthy living from working the web. As a day job, he works as a pilot for an international airline. Follow Marty on Twitter or Google+.

Comments

  1. Ramona says:

    “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

    • Marty says:

      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!

  2. clint says:

    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?

    • Marty says:

      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.

  3. Ethan says:

    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?

  4. Marty says:

    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.

  5. Migdi says:

    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.

    • Marty says:

      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!

  6. Migdi says:

    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.

  7. Bidderboy says:

    this is really fantastic solution for designing a nice testimonial page. thanks for sharing.

Trackbacks

  1. [...] I recently had a request for some shortcode that would render formatted images and text in a particular way. When I tried to [...]

  2. [...] This post will provide you with code that’ll read the contents of an XML file and render that data anywhere you want it (using WordPress shortcode). If you’re after individual testimonials in your post that are created exclusively with shortcode, I wrote a quick post back in 2011 showing how that could be accomplished. Check it out here. [...]

Speak Your Mind

*