[resolved] Change rel="lightbox" to class="lightbox" (3 posts)

  1. Brobbelmaster
    Posted 4 years ago #

    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]".

  2. adpawl
    Posted 4 years ago #

    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');
  3. Brobbelmaster
    Posted 4 years ago #

    Thank you, it works correctly. ^^

Topic Closed

This topic has been closed to new replies.

About this Topic