wordpress - get_attachment from functions.php -


i'm trying open image lightbox (colorbox) , when did, have button opens link it's attachment-page.

i made attribute data-att="" link attachment-page should get.

here have in functions.php right now:

add_filter('the_content', 'add_colorbox');   function add_colorbox($content) {     global $post;     $att_url = wp_get_attachment_link($id);     $pattern ="/<a(.*?)href=('|\")(.*?).(bmp|gif|jpeg|jpg|png)('|\")(.*?)>/i";     $replacement = '<a$1href=$2$3.$4$5 class="fotos" data-att="'. $att_url .'" title="'.$post->post_title.'"$6>';     $content = preg_replace($pattern, $replacement, $content);   return $content;    } 

so $att_url = get_attachment_link($id); im trying attachment link , pass data-att="..." no luck yet...


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -