WordPress.org

Ready to get started?Download WordPress

Forums

Random Text
Rich Text in Random Text (3 posts)

  1. enso
    Member
    Posted 1 year ago #

    I chose Random Text out of all the testimonial widget plugins I looked at due to its simplicity. It doesn't have a bunch of features that neither I nor my customers need or want. It is lacking one thing, though. I wanted my customers to be able to include formatted text without having to write any HTML, so I poked around in the code and came up with a simple solution that I'm sharing here in case anyone else would like to use it.

    I edited the randomtext_admin.php file to replace the editable textarea with the WordPress TinyMCE editor and add a filter so that the HTML doesn't show in the excerpt in the list of entries.

    To add the TinyMCE editor find the PHP function randomtext_edit and replace the entire PHP statement that begins with

    echo '<form method="post"

    with the code at

    http://pastebin.com/raw.php?i=uJTifunF

    I added the "array ('wpautop' => false)" option because I didn't want the editor to remove any markup I added in the HTML editor, but you can take it out if you prefer.

    To prevent the HTML tags from showing in the excerpts find the PHP function randomtext_list. Scroll down to the foreach loop at bottom of the function and replace the statement

    $bytes = strlen($row->text);

    with the statement

    $bytes = strlen($row->text = strip_tags ( $row->text ));

    That's it! I've been using the modified version for a while now with no problems. YMMV. Use at your own risk.

    http://wordpress.org/extend/plugins/randomtext/

  2. biscuitsndavey
    Member
    Posted 1 year ago #

    This is a GREAT fix for a number of reasons. I'm now using Random Text to randomly pull images that link to different URL's, and it was all possible due to adding the TinyMCE editor and getting it to read the markup. THANK YOU.

  3. dmahler
    Member
    Posted 11 months ago #

    You rock! Thanks so much!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags