[wp-hackers] the_alt_title recomendation
Ryan Boren
ryan at boren.nu
Fri Aug 6 01:40:44 UTC 2004
On Thu, 2004-08-05 at 19:24 -0600, Chris Coggburn wrote:
> Ryan Boren wrote:
>
> >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&title=stuff' alt='Wordpress Plugin: Title Images2' />">
> >> <img src='titleimages2.php?func=generate&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>
> >
> >
> >
> What I was saying is to not strip tags but to allow plugins to modify
> both the permalink text and the actual title code though filters. If you
> give both a filter it would make things alot nicer for plugins that
> modify the title of a post.
I was hoping it would be sufficient for the title to have filters run on
it and then the alt title be the same thing but with tags stripped. I
guess you need the extra control for your Title Images plugin.
Hopefully we don't need filters for other attributes. That would be
getting rather pathologically configurable.
BTW, my strip_tags() example is broken for two reasons. First, I put the
strip_tags() around the wrong the_title() call. Second, the_title()
echos instead of returns. Duh. That's what I get for not actually
trying out my suggestions.
Ryan
More information about the hackers
mailing list