[wp-hackers] the_alt_title recomendation

Ryan Boren ryan at boren.nu
Fri Aug 6 00:34:23 UTC 2004


On Thu, 2004-08-05 at 17:28 -0600, Chris Coggburn wrote:
> I believe that the Wordpress developers need to add a function and 
> filter similar to the_title but for use only in the alt tags.
> For example:
> 
> <a href="http://chris.coggburn.us/archives/2004/08/04/title-images2-plugin/" rel="bookmark" title="permanent link: <img src='titleimages2.php?func=generate&amp;title=stuff' alt='Wordpress Plugin: Title Images2' />">
>   <img src='titleimages2.php?func=generate&amp;title=Stuff' alt='Stuff' />
> </a>
> 
> That happens when the the_title filter applies html tag to format a title(For example, my Title Images2 plugin).
> It would be much better to have a seperate tag called the_alt_title() which can have its own filter to format the 
> title in the alt tags. Now, I was talking to masquerade from #wordpress and he mentioned that for PatchDay he made a patch
> that would add this support Wordpress and he was told it was commited. Where is it? The bug is located at:
> http://mosquito.wordpress.org/bug_view_page.php?bug_id=0000107
> Without support for this feature my plugin will require users to modify their template, which I really wish I did not have to do.

Actually, that patch doesn't fix this.  It fixes something else.

A separate tag may be in order since we want to strip_tags against the
alt title but not on the regular title.  Or, we could replace all of
this:

<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link:
<?php the_title(); ?>"><?php the_title(); ?></a>

with:

<?php post_link(__('Permanent Link: %s')); ?>

And handle the strip_tags in there.  For those who want to fix this in
their existing templates, change it to:

<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link:
<?php the_title(); ?>"><?php strip_tags(the_title()); ?></a>


Something to think upon.

Ryan




More information about the hackers mailing list