[buddypress-trac] [BuddyPress] #4770: Linking in the forum loop
buddypress-trac
noreply at wordpress.org
Wed Jan 16 13:32:21 UTC 2013
#4770: Linking in the forum loop
-------------------------+-----------------------------
Reporter: chouf1 | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Forums | Version:
Severity: normal | Keywords:
-------------------------+-----------------------------
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' ); ?>">
}}}
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/4770>
BuddyPress <http://buddypress.org/>
BuddyPress
More information about the buddypress-trac
mailing list