Changeset 3109 for branches/plugin/bbp-includes/bbp-topic-template.php
- Timestamp:
- 05/06/2011 10:45:55 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-topic-template.php
r3101 r3109 1719 1719 1720 1720 $defaults = array( 1721 'before' => '< p>' . __( 'Tagged:', 'bbpress' ) . ' ',1721 'before' => '<div class="bbp-topic-tags"><p>' . __( 'Tagged:', 'bbpress' ) . ' ', 1722 1722 'sep' => ', ', 1723 'after' => '</p> '1723 'after' => '</p></div>' 1724 1724 ); 1725 1725 … … 2566 2566 } 2567 2567 2568 /** Topic Tags ****************************************************************/ 2569 2570 /** 2571 * Output the id of the current tag 2572 * 2573 * @since bbPress (r3109) 2574 * 2575 * @uses bbp_get_topic_tag_id() 2576 */ 2577 function bbp_topic_tag_id() { 2578 echo bbp_get_topic_tag_id(); 2579 } 2580 /** 2581 * Return the id of the current tag 2582 * 2583 * @since bbPress (r3109) 2584 * 2585 * @uses get_term_by() 2586 * @uses get_query_var() 2587 * @uses apply_filters() 2588 * 2589 * @return string Term Name 2590 */ 2591 function bbp_get_topic_tag_id() { 2592 2593 // Get the term 2594 $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); 2595 2596 // Add before and after if description exists 2597 if ( !empty( $term->term_id ) ) 2598 $retval = $term->term_id; 2599 2600 // No id 2601 else 2602 $retval = ''; 2603 2604 return apply_filters( 'bbp_get_topic_tag_id', $retval ); 2605 } 2606 2607 /** 2608 * Output the name of the current tag 2609 * 2610 * @since bbPress (r3109) 2611 * 2612 * @uses bbp_get_topic_tag_name() 2613 */ 2614 function bbp_topic_tag_name() { 2615 echo bbp_get_topic_tag_name(); 2616 } 2617 /** 2618 * Return the name of the current tag 2619 * 2620 * @since bbPress (r3109) 2621 * 2622 * @uses get_term_by() 2623 * @uses get_query_var() 2624 * @uses apply_filters() 2625 * 2626 * @return string Term Name 2627 */ 2628 function bbp_get_topic_tag_name() { 2629 2630 // Get the term 2631 $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); 2632 2633 // Add before and after if description exists 2634 if ( !empty( $term->name ) ) 2635 $retval = $term->name; 2636 2637 // No name 2638 else 2639 $retval = ''; 2640 2641 return apply_filters( 'bbp_get_topic_tag_name', $retval ); 2642 } 2643 2644 /** 2645 * Output the slug of the current tag 2646 * 2647 * @since bbPress (r3109) 2648 * 2649 * @uses bbp_get_topic_tag_slug() 2650 */ 2651 function bbp_topic_tag_slug() { 2652 echo bbp_get_topic_tag_slug(); 2653 } 2654 /** 2655 * Return the slug of the current tag 2656 * 2657 * @since bbPress (r3109) 2658 * 2659 * @uses get_term_by() 2660 * @uses get_query_var() 2661 * @uses apply_filters() 2662 * 2663 * @return string Term Name 2664 */ 2665 function bbp_get_topic_tag_slug() { 2666 2667 // Get the term 2668 $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); 2669 2670 // Add before and after if description exists 2671 if ( !empty( $term->slug ) ) 2672 $retval = $term->slug; 2673 2674 // No slug 2675 else 2676 $retval = ''; 2677 2678 return apply_filters( 'bbp_get_topic_tag_slug', $retval ); 2679 } 2680 2681 /** 2682 * Output the description of the current tag 2683 * 2684 * @since bbPress (r3109) 2685 * 2686 * @uses bbp_get_topic_tag_description() 2687 */ 2688 function bbp_topic_tag_description( $args = array() ) { 2689 echo bbp_get_topic_tag_description( $args ); 2690 } 2691 /** 2692 * Return the description of the current tag 2693 * 2694 * @since bbPress (r3109) 2695 * 2696 * @uses get_term_by() 2697 * @uses get_query_var() 2698 * @uses apply_filters() 2699 * 2700 * @return string Term Name 2701 */ 2702 function bbp_get_topic_tag_description( $args = array() ) { 2703 global $bbp; 2704 2705 $defaults = array( 2706 'before' => '<div class="bbp-topic-tag-description"><p>', 2707 'after' => '</p></div>' 2708 ); 2709 $r = wp_parse_args( $args, $defaults ); 2710 extract( $r ); 2711 2712 // Get the term 2713 $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); 2714 2715 // Add before and after if description exists 2716 if ( !empty( $term->description ) ) 2717 $retval = $before . $term->description . $after; 2718 2719 // No description, no HTML 2720 else 2721 $retval = ''; 2722 2723 return apply_filters( 'bbp_get_topic_tag_description', $retval, $args ); 2724 } 2725 2568 2726 /** Forms *********************************************************************/ 2569 2727
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)