• hi. need your help to modify this code so it will add rel to attachment page also

    add_filter('the_content', 'addshadowboxrel', 12);
    add_filter('get_comment_text', 'addshadowboxrel');
    function addshadowboxrel ($content)
    {   global $post;
    	$pattern = "/<a(.*?)href=('|\")([^>]*).(bmp|gif|jpeg|jpg|png)('|\")(.*?)>(.*?)<\/a>/i";
        $replacement = '<a$1href=$2$3.$4$5 rel="shadowbox['.$post->ID.']"$6>$7</a>';
        $content = preg_replace($pattern, $replacement, $content);
        return $content;
    }

    this works only for images but i’d like to open an attachment page in shadowbox also

    thanks

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘need help’ is closed to new replies.