#4770 closed enhancement (fixed)
Linking in the forum loop
Reported by: | chouf1 | Owned by: | |
---|---|---|---|
Milestone: | 1.7 | Priority: | normal |
Severity: | normal | Version: | 1.2 |
Component: | Forums | Keywords: | commit |
Cc: |
Description
While building the buddy bbpress support topic plugin, we encontered a small detail about redondancy while trying to apply css styling into the forum loop.
Actually the forum-loop contains this
<a class="topic-title" href="<?php bp_the_topic_permalink(); ?>" title="<?php bp_the_topic_title(); ?> - <?php _e( 'Permalink', 'buddypress' ); ?>">
To add some text before the title, we use in our plugin
return __('[Resolved] ', 'buddy-bbpress-support-topic') . $topic_title;
And to add some style to the additionnal text we use:
return '<span class="green">'. __('[Resolved] ', 'buddy-bbpress-support-topic').'</span> '. $topic_title;
But the final result is wrong and weird !
<a class="topic-title" href="http://example.com/groups/test/forum/topic/plugin-test" title="<span class=" green"="">[Resolved] Plugin test - Permalink"> <span class="green">[Resolved] </span> Plugin test </a>
And on the frontend we see: [Resolved] Plugin test - Permalink"> [Resolved] Plugin test !!!
To get it correctly, we had to retrieve the bp_the_topic_title from the forum-loop :
<a class="topic-title" href="http://example.com/groups/test/forum/topic/plugin-test" title="Permalink to this post"> <span class="green">[Resolved] </span> Plugin test </a>
The title attribute is optional. But when used, it has to give additonnal information. In the present case, for the anchor. The href contains the post title in the URI, and the additionnal information to this formed link is "permalink". So it's not necessary to repeat the post title in the title attribute.
http://www.w3.org/TR/html401/struct/links.html#h-12.1.3
I suggest to modify the actual loop from this
<a class="topic-title" href="<?php bp_the_topic_permalink(); ?>" title="<?php bp_the_topic_title(); ?> - <?php _e( 'Permalink', 'buddypress' ); ?>">
to this
<a class="topic-title" href="<?php bp_the_topic_permalink(); ?>" title="<?php _e( 'Permalink to this post', 'buddypress' ); ?>">
Change History (5)
#1
@
12 years ago
- Component changed from Forums to Theme
- Keywords dev-feedback added
- Version set to 1.2
#3
@
12 years ago
- Component changed from Theme to Forums
- Keywords commit added; dev-feedback removed
- Milestone changed from Awaiting Review to 1.7
#4
@
12 years ago
- Resolution set to fixed
- Status changed from new to closed
(In [6725]) Change 'title' attribute for topic links in group forum loop template.
In the topic title link, bp_the_topic_title() is used twice: once
in the 'title' attribute and again for the anchor text.
For plugin devs wanting to manipulate the HTML markup for the topic
title, this would cause unintended output in the 'title' attribute.
Therefore, this commit removes bp_the_topic_title() from the 'title'
attribute for topic links.
Fixes #4770. Props chouf1.
I'm okay with this change in /forums/forums-loop.php. Any objections from the other devs?