Wordpress cloning image alt/title tags?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Socks
    Confirmed User
    • May 2002
    • 8475

    #1

    Wordpress cloning image alt/title tags?

    I usually write the same thing for alt/title tags, would be nice to just enter it in once and have it get used for both fields. Is there a plugin that does that? I don't want a generator, I just want to do it once per image rather than twice.
  • papill0n
    Unregistered Abuser
    • Oct 2007
    • 15547

    #2
    seo image

    Comment

    • Why
      MFBA
      • Mar 2003
      • 7230

      #3
      change the core code or change your template.

      both are very easy, should take under a minute.

      Comment

      • fris
        Too lazy to set a custom title
        • Aug 2002
        • 55689

        #4
        Originally posted by Socks
        I usually write the same thing for alt/title tags, would be nice to just enter it in once and have it get used for both fields. Is there a plugin that does that? I don't want a generator, I just want to do it once per image rather than twice.
        you could make it use the post title for the alt and title tag for images.
        Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.

        Comment

        • fris
          Too lazy to set a custom title
          • Aug 2002
          • 55689

          #5
          something like this maybe

          Code:
          function change_image_stuff($html) {
                  global $post;
                  $html = preg_replace('/(alt|title)=\"[^"]*"\s/','$1="'.$post->post_title.'" ', $html);
                  return $html;
          }
          
          add_filter( 'post_thumbnail_html', 'change_image_stuff', 10 );
          add_filter( 'image_send_to_editor', 'change_image_stuff', 10 );
          Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.

          Comment

          Working...