• Hi

    I am having problems overriding the default action of the_post_thumbnail(). I have looked around and everyone says this code will work:

    <?php the_post_thumbnail('thumbnail', array( 'alt' => 'alttext', 'title' => 'titletext' )); ?>

    I get a thumbnail allright but the alt text and title text is from the original image, not ‘alttext’ and ‘titletext’ …

    Has this been changed in WP 3+? I have no idea why this isn’t working.

Viewing 2 replies - 1 through 2 (of 2 total)
  • It looks like it should be working to me. Do you have any filters running on the_post_thumbnail?

    Refer to the_post_thumbnail in the codex for more details.

    Thread Starter edzah

    (@bloofood)

    Thanks Chris

    The entirety of my theme’s functions.php

    <?php
    if ( function_exists('register_sidebar') )
        register_sidebar(array(
            'before_widget' => '<li>',
            'after_widget' => '</li>',
            'before_title' => '<div>',
            'after_title' => '</div>',
        ));
    if ( function_exists( 'add_theme_support' ) ) {
      add_theme_support( 'post-thumbnails' );
    }
    ?>

    so no add_filter there. Must say I have never used filters before.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wp_post_thumbnail ALT and TITLE tags won't work’ is closed to new replies.