Thumbnails and Lightbox

Thank you Jeremy Jared. I applied the following solution, based on yours ( Any good lightbox-like option that works in WP 3.2.1? )

First of all, now I call my thumbnail with the following code instead of trying to add the link myself:

wp_get_attachment_link(get_post_thumbnail_id(), 'thumbnail');

Then, I add your filter in function.php

*        Lightbox        *
  //can be replaced in any child template
if (!function_exists('CJG_add_lightbox_to_achor')) {
    function CJG_add_lightbox_to_achor(){
        return 'rel="slb"';

add_filter('wp_get_attachment_link' , 'CJG_lightbox_rel');
function CJG_lightbox_rel($attachment_link ) {
    $attachment_link = str_replace( 'a href' , 'a '.CJG_add_lightbox_to_achor().' href' , $attachment_link );
    return $attachment_link;

It is not 100% what I expected, I wanted the plugins to work without any particular add because I might change one day and this solution makes me change it for each website instead of a general change on my WordPress Network. But it’s still a lot better than anything that I had done before.