WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Change rel="lightbox" to class="lightbox"

[Resolved] Change rel="lightbox" to class="lightbox"

  • Well I would need a function so that all rel=”lightbox” get changed to class=”lightbox”, for pages and posts.
    I don’t want to replace them by a DB Query ’cause we’re using multiple themes and one of them is not coded in HTML5 but in XHTML 1.1 which doesn’t lists rel=”lightbox” as an error.

    And also sometimes it’s rel=”lightbox[%number%]” or rel=”lightbox[gal]”.

Viewing 2 replies - 1 through 2 (of 2 total)
  • try add to functions.php:

    function fix_lightbox($content) {
    	$content=str_replace('rel="lightbox', 'class="lightbox', $content);
        return $content;
    }
    add_filter ('the_content', 'fix_lightbox');

    Thank you, it works correctly. ^^

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Change rel="lightbox" to class="lightbox"’ is closed to new replies.
Skip to toolbar