Forums

Media Library Categories
[resolved] Added support for rel attribute (2 posts)

  1. lilqhgal
    Member
    Posted 2 years ago #

    Awesome little plugin. Very happy with it so far. Makes utilizing the default WordPress media library for a simple photo gallery great!!

    One drawback I didn't like was the absence of the rel attribute, for use with lightbox plugins, so I modified the /includes/shortcodes.php file as follows:

    1. line 25, look for:
    'target' => '_blank'
    and change to:
    'target' => '_blank', (just add a comma after the last quote

    2. after line 25, add a new line:
    'rel' => ''

    3. if you want rel attribute support added only to jpg images, look for line 211:
    {$content .= "<li>".(($include_link=="true")?"<a href='".$fileUrl."' target='$target'>":"")."<img src='".$thumb[0]."' />".(($include_link=="true")?"</a>":"")."</li>"; }
    and change to:
    {$content .= "<li>".(($include_link=="true")?"<a href='".$fileUrl."' target='$target' rel='$rel'>":"")."<img src='".$thumb[0]."' />".(($include_link=="true")?"</a>":"")."</li>"; }

    4. if you want rel attribute support added to all media types, look for line 215:
    {$content .= "<li>".(($include_link=="true")?"<a href='".$fileUrl."' target='$target'>":"").$label.(($include_link=="true")?"</a>":"")."</li>"; }
    and change to:
    {$content .= "<li>".(($include_link=="true")?"<a href='".$fileUrl."' target='$target' rel='$rel'>":"").$label.(($include_link=="true")?"</a>":"")."</li>"; }

    Now, just add rel='myLightboxRel' to your shortcode and viola! Hope that helps someone and maybe the developer can add it to the next version?

    http://wordpress.org/extend/plugins/media-library-categories/

  2. merganser
    Member
    Plugin Author

    Posted 2 years ago #

    I will do so. Thanks lilqhgal!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic