Give help. Get help.

  • # January 17, 2013 at 2:41 am


    I’m creating a featured post slider for WordPress. In order to get an HTML caption to display, I need to set the title of the featured image to the post’s ID (title=”#post-id”). I’m thinkin something on the lines of…

    < ?php the_post_thumbnail('article-banner',array( 'class' => “”, ‘title’ => ” #.get_the_ID(); “)); ? >

    …but I’m not sure if that’ll work and it seems a little contrived. The output that I’m ultimately looking for needs to be:

    < img src="media/featured-image.jpg" alt="" title="#post-id" / >

    Any help would be appreciated. Thanks in advance.

    # January 17, 2013 at 7:57 am

    You can add title to the featured image:

    < ?php echo get_the_post_thumbnail($id, '', array( 'title' => '#post-id' )); ?>

    # January 18, 2013 at 1:29 am

    Hey, @realife, thanks. Could you explain how this would pull the post’s ID into the title tag? At face value, this doesn’t look like it would work?


Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.