Need help with simple plugin (4 posts)

  1. RobotDan
    Posted 10 years ago #

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


    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
    Posted 10 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');
    function hide_show_button()
    function add_edit_button($caption, $js_onclick, $title = '')


  3. RobotDan
    Posted 10 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
    Posted 10 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic