Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Here is the mix of things for the Group/forum-tags I'm using with my BPress Site:
- //FIRST Add this to the functions.php -It came from here: http://bbpress.org/forums/topic/changing-tag-list-view
- //topic tags as row
- function bb_row_tags( $args = null ) {
- $defaults = array(
- 'tags' => false,
- 'format' => 'row',
- 'topic' => 0,
- );
- $args = wp_parse_args( $args, $defaults );
- extract( $args, EXTR_SKIP );
- if ( !$topic = get_topic( get_topic_id( $topic ) ) ) {
- return false;
- }
- if ( !is_array( $tags ) ) {
- $tags = bb_get_topic_tags( $topic->topic_id );
- }
- if ( !$tags ) {
- return false;
- }
- $r = '';
- switch ( strtolower( $format ) ) {
- case 'row' :
- default :
- $args['format'] = 'row';
- foreach ( $tags as $tag ) {
- $r .= _bb_row_tag_item( $tag, $args );
- }
- break;
- }
- echo $r;
- }
- function _bb_row_tag_item( $tag, $args ) {
- $url = esc_url( bb_get_tag_link( $tag ) );
- $name = esc_html( bb_get_tag_name( $tag ) );
- if ( 'row' == $args['format'] ) {
- $id = 'tag-' . $tag->tag_id . '_' . $tag->user_id;
- return "\t" . '<a href="' . $url . '" rel="tag">' . $name . '</a>' . "\n";
- }
- }
- //SECOND -Change Rich's Code Found here to this:
- <div id="forum-topic-tags">
- <?php _e('<p><b>Specific Forum Topic Tags:</b></p>'); ?>
- <?php
- $ttags = bb_get_topic_tags( bp_get_the_topic_id() );
- if ( $ttags ) : ?>
- <?php bb_row_tags( 'topic='. bp_get_the_topic_id() .'tags='.$ttags ); ?>
- <?php else : ?>
- <?php printf(__('<p>No <a href="%s">tags yet.</p>'), bp_get_forum_directory_permalink() . '/#tags' ); ?>
- <?php endif; ?>
- </div>
- //THIRD add the above combined with what is listed below (will also add groups tag heat map) to the topic.php file in the groups/single/forum of the theme...
- // This is Directly Above --> <?php if ( bp_has_forum_topic_posts() ) : ?> ADD BELOW -Not this line.
- <div id="topic-tags">
- <p><b>Popular Topic Tags From Across The Groups:</b></p>
- <?php bb_tag_heat_map(array( 'smallest' => 9, 'largest' => 15, 'limit' => 50)); ?>
- </div>
- <div id="forum-topic-tags">
- <?php _e('<p><b>Specific Forum Topic Tags:</b></p>'); ?>
- <?php
- $ttags = bb_get_topic_tags( bp_get_the_topic_id() );
- if ( $ttags ) : ?>
- <?php bb_row_tags( 'topic='. bp_get_the_topic_id() .'tags='.$ttags ); ?>
- <?php else : ?>
- <?php printf(__('<p>No <a href="%s">tags yet.</p>'), bp_get_forum_directory_permalink() . '/#tags' ); ?>
- <?php endif; ?>
- </div>
- //This is directly below --> <form action="<?php bp_forum_topic_action() ?>" method="post" id="forum-topic-form" class="standard-form"> ADD ABOVE -not this line
- //FOURTH Add some CSS to your default.css file:
- #topic-tags {
- border-top: 2px solid #0066FF;
- Border-bottom: 2px solid #0066FF;
- background-color:#FFF4BB;
- padding-top:3px;
- padding-left:6px;
- padding-right: 6px;
- padding-bottom:10px;
- }
- #forum-topic-tags {
- border-top: 1px solid #FFFFFF;
- Border-bottom: 2px solid #0066FF;
- background-color:#FFEC8E;
- padding-top: 8px;
- padding-left: 6px;
- padding-right 6px;
- padding-bottom 10px;
- margin-bottom: 7px;
- }
- //That is what I did... I'm not a programmer and this is certainly a hack, but it is working
Add Comment
Please, Sign In to add comment