• Does anyone know how I can add id=”” to thumbnails in index.

    <img class="alignleft size-thumbnail wp-image-104" title="my_image" src="my_image-150x150.jpg" alt="" width="150" height="150" />

    WordPress just adds class, but I need id too 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • Why do you need to add id? You can access it with the parent tag.
    for example if the code looks like this . . .

    <div id="post">
    <img class="alignleft size-thumbnail wp-image-104" title="my_image" src="my_image-150x150.jpg" alt="" width="150" height="150" />
    </div>

    Then you can access it by #post img{width=200px;}

    Thread Starter Sinopa

    (@sinopa)

    I need the ID tag because I’m adding custom jquery tooltips to thumbnail images.

    do something like this:

    $attr = array(
      'id' => 'slide_thumb_'.$post->ID
    );
    echo get_the_post_thumbnail( $post->ID, 'thumbnail', $attr );

    Then you can use #slide_thumb_<your_post_id> as selector.

    also see http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail

    BR\ME

    Thread Starter Sinopa

    (@sinopa)

    Could you please tell me how to implement that?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Add id="" to thumbnails in index’ is closed to new replies.