Welcome to Dagon Design. In addition to free scripts, WordPress plugins, and articles, we offer a variety of services including custom theme design, plugin creation, and PHP scripting. Contact me for more information.

Version 1.2   Updated Thursday, February 19th, 2009 at 7:19pm

Expanding Text plugin for WordPress

This WordPress plugin allows you to create sections of text in your post or page which expand/collapse when clicked on. You simply wrap the special tags around your text, and set the ‘expand link’ (the link visitors click on to show the text). If your visitors do not have javascript enabled, the ‘expand link’ is not shown, and the text is displayed normally.

Download

  If you have found this page useful, please consider donating. Thanks!

Change Log

  • 02-19-09 Version 1.2 – Changed wrapper tags *must change existing links when updating!* Fixed validation errors, and issues switching between code and html view
  • 10-09-08 Version 1.1 – Now works properly when the exact same expanding text is used more than once on the page
  • 08-14-08 Version 1.0 – First release

Installing

  • Download the above file, rename it from .txt to .php, and upload it to your plugins directory.
  • Enable the plugin.
  • Optional: Add the CSS to your theme’s style sheet to make it look nice (see the customization section below).

Usage

To make your text expand/collapse, use the following format in your post or page:

Important: Make sure you add this using the html/code editor in WordPress, not the visual editor. In new versions of WordPress, just click the ‘html’ button above the edit box. If you use the visual editor it will not work, as the actual code you entered will be seen on the page, instead of being processed by the script.

Notice: If upgrading from version 1.1, make sure you change your existing code to match the examples below. The tags have been changed to cause less issues.

[DDET (expand link text)]
(Text to expand)
[/DDET]

Example:

[DDET Click to expand!]
Here is your text!
[/DDET]

You can add as many sections of expanding text as you like.

Demo

Here you can see the plugin in action:

Here is your text! Here is your text! Here is your text! Here is your text! Here is your text! Here is your text! Here is your text! Here is your text! Here is your text! Here is your text! Here is your text! Here is your text! Here is your text! Here is your text! Here is your text! Here is your text! Here is your text! Here is your text! Here is your text! Here is your text!

Customization

To style the expanding text boxes, you must add the .ddet_div class to your theme’s css file. Here is an example:

.ddet_div {
  margin: 8px 0 0 12px;
  padding: 8px;
  background: #F4F4F4;
  border: 1px solid #DDDDDD;
}

Pages: « 9 8 7 [6] 5 4 3 2 1 » Show All

  1. Nevermind my last… It’s working now…
    Thanx.

  2. The plugin does not have a valid header.

    I got that error when activating the plugin. I’m using WordPress 2.8.
    How can i solve this? thanx…

  3. 88
    Brian

    I really like your plugin. I like how you can use style sheet customizations. Here is my issue I would like to have multiple links customized but i can’t use the div id number because it changes every refresh. Is there a way to do this?

  4. Hi. Just a quick one. How can I add an image, when at default, maybe displays a “+” sign to display the content and when clicked/ toggled, displays a “-” sign to hide content. How can I go about doing that? Anyone? Much appreciated! Cheers!

    Lea
    Malaysia

  5. I was looking for this very function in wordpress. Very useful plugin indeed! How to add the sliding effect to this? Could you please add that too?

  6. As Usual from Dagon Design, Simple But Sweet,

    Thanks Guys.

  7. Perfect, worked like a charm. Thank you.

  8. Thanks so much for this plugin. I only have one question. Where in the CSS style sheet does the customization code go?

    Thanks again!

  9. 82
    nguJ

    Before you comment: If you are having an issue with a script, please make sure you have read the entire article. Also, please read through the comments because most common issues have already been discussed many times

  10. This plugin has been tested, and works with the latest release (2.8)

    Rolando: Adding those extra lines in the javascript may prevent it from working properly. I would re-install the plugin.

    I am looking into other options for the script, but making the javascript work as it does now was tricky enough ;)

  11. thanks! this version sorted out a bug in the last one which kept making me re-enter the code everytime i made a change to the post, the new [DDET] tag seems to have fixed it.

  12. Well I tried again on another website I own but with a wordpress 2.6.1 version, and the problem is still the same…

  13. Well I don’t know why there’s the same id on both DDET and yours has 2 different id… I’m usig Wordpress 2.8, maybe that’s why it’s not working?

  14. Here’s the screenshot of the code
    http://www.zimagez.com/zimage/ddet.php

  15. Hi Rolando,

    I haven’t deleted those lines. Do I have to?

    [quote]
    L47: mt_srand((double)microtime()*1000000);
    L48: $rnum = mt_rand();
    [/quote]

Pages: « 9 8 7 [6] 5 4 3 2 1 » Show All

Leave a Comment

Before you comment: If you are having an issue with a script, please make sure you have read the entire article. Also, please read through the comments because most common issues have already been discussed many times. Thanks.


Be sure to wrap all code in <code></code> tags.