• Hi,
    I have a small problem. When making a slider I have to make caption to depend on img. Best way I found for connectiong is to use post ID.

    I would like title to additionally have ID suffix like #caption1.
    <?php the_post_thumbnail( 'thumb' , array('title' => '#caption') );?>

    for my caption div it`s just
    id="caption<?php the_ID(); ?>"
    , but I can`t find a way to add same thing to this title.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello,

    Perhaps try get_the_id. It retrieves the post ID in the same way as the_id, but doesn’t echo it. You’d use it like this:

    <?php the_post_thumbnail( 'thumb' , array( 'title' => '#caption' . get_the_ID() ) ); ?>
    Thread Starter Trimek

    (@trimek)

    Thanks very much, that was the issue, put get_the_ID in attribute and the_ID in html.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘title in array with ID dependency’ is closed to new replies.