WordPress.org

Ready to get started?Download WordPress

Forums

Need help with simple plugin (4 posts)

  1. RobotDan
    Member
    Posted 8 years ago #

    I'd like to implement this css/javascript photo displaying script on my site:

    http://www.huddletogether.com/projects/lightbox/

    All that I need to do is add rel="lightbox" into the link tag of the code that's produced when you use the new File Upload box to add an image to the post, where you specify it to use the thumbnail and having it linked to an image.

    i.e. Instead of

    <a href="http://www..../image.jpg" title="image">...

    it would show

    <a href="http://www..../image.jpg" title="image" rel="lightbox">...

    While it would be easy enough to hack the code, could somebody tell me how to write a plugin which adds this code in?

  2. VaamYob
    Member
    Posted 8 years ago #

    You can create a plugin that adds a button to the edit post page that generates the html:

    <a ... rel="lightbox"></a>

    You can view my hide/show plugin for a simple example of adding a button to insert html into the content.

    The relevant parts are:

    add_filter('admin_footer', 'hide_show_button');
    and
    function hide_show_button()
    and
    function add_edit_button($caption, $js_onclick, $title = '')

    http://www.xyooj.com/blog/plink/technical/26/hideshow/

  3. RobotDan
    Member
    Posted 8 years ago #

    Thanks for the idea, but my website's authors are using the File Upload box in WordPress 2.0... they aren't too hot with editing HTML. I've not written a plugin before but I think a filter function should do it... but how do I get it to add the code to only the link tags pointing to images?

  4. the13th
    Member
    Posted 8 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic