RBA Cash Rate: 4.35% · 1AUD = 0.67 USD · Inflation: 4.1%  
Leading Digital Marketing Experts | 1300 235 433 | Aggregation Enquires Welcome | Book Appointment
Example Interest Rates: Home Loan Variable: 5.38% (6.14%*) • Home Loan Fixed: 5.44% (6.26%*) • Fixed: 5.44% (6.26%*) • Variable: 5.38% (6.14%*) • Investment IO: 5.69% (6.52%*) • Investment PI: 5.49% (5.98%*)

Simple Expanding Blind WordPress Shortcode

Simple Expanding Blind WordPress Shortcode

This old code was literally a 5-minute fix to a problem a friend was having on his website. He wanted a lightweight option for an expanding blind that would reveal "hidden" content. It was literally written and posted via my Nokia E72 (back when they were cutting-edge) while I was a passenger in a car.

Note: This snippet is updated and can found here.

There are a lot of JavaScript libraries that'll render flashy blind animations and provide lots of glossy features. These options, however, come at the expense of page-load time, compatibility, and often have a number of dependencies. What you'll find on this page is extremely simple in comparison.

Contrary to best practice, we don't print the JavaScript and CSS into the head of the document as we should. However, this inline CSS and JS avoids callback options (so the JS and CSS won't load on every page). That said, we do scope the CSS which is becoming a more accepted means of inline CSS.

We've just revisited this code ourselves because we want to print the change log under each download. Rather than display it by default we'll provide an opening and closing blind for those that are interested. Consistent with our new mantra of simple design, this shortcode feature more than meets our needs.

Example:

Shortcode used is in the following format: [blind text="Add Your Link Text Here"]Your Content is here (wrapped in <strong>blind</strong> tags).[/blind].

The text attribute is optional. If you have default link text, you only need to use the opening and closing blind tags.

WordPress Shortcode

Copy and paste the WordPress function into your theme's functions.php file or, if you sensibly have one installed, your custom functions plugin. You may optionally download and install our plugin from the bottom of of the page.

Code Removed. Updated here.

If you require shortcode to work in a sidebar widget, you'll have to enable the functionality with a filter. If you're using our custom functions plugin, you'll have that feature enabled by default.

Considerations

  • We're looking forward to revisiting this in the future in an attempt to clean it up and make it a little fancy.
  • The plugin below displays JS and CSS inline. The operation of checking for the shortcode in the post text (to determine if we load the CSS and JS) was more expensive than just serving it.
  • While multiple instances of the blind may be used on the same page, it's a bad terrible idea. To avoid the CSS and JS loading for each blind, copy the relevant code into your custom functions file. We wrote it so we could use it once on every page.

Download


Title: Simple Expanding Blind in WordPress (WP Plugin)
Description: Display content in a simple dropdown blind with WordPress shortcode.
  Download • Version 0.3, 1.6K, zip, Category: WordPress Plugins (General)
WordPress Shortcodes, (767.0B)    

■ ■ ■

 
Download our complimentary 650-page guide on marketing for mortgage brokers. We'll show you exactly how we generate billions in volume for our clients.
Finance Guide, Cropped Top and Bottom
  Timezone: 1 · [ CHANGE ]

RELATED READING

Like this article?

Share on Facebook
Share on Twitter
Share on Linkdin
Share on Pinterest

Leave a comment