Skip to:
Content

bbPress.org


Ignore:
Timestamp:
05/28/2011 09:06:09 AM (15 years ago)
Author:
johnjamesjacoby
Message:

Commit bomb of improvements to the breadcrumb.

Checking for topic views, forum and topic archives, and do not check if the root slug is included in the URL.
Add breadcrumb to forum archive and topic archive, since they exist one level deeper than the "Home" page.
Add template tags to handle the forum/topic archive titles, which use a corresponding page title if one exists, and fallback to the post type label 'name' if not.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-includes/bbp-topic-template.php

    r3243 r3250  
    461461
    462462                return apply_filters( 'bbp_get_topic_title', get_the_title( $topic_id ), $topic_id );
     463        }
     464
     465/**
     466 * Output the topic archive title
     467 *
     468 * @since bbPress (r3249)
     469 *
     470 * @param string $title Default text to use as title
     471 */
     472function bbp_topic_archive_title( $title = '' ) {
     473        echo bbp_get_topic_archive_title( $title );
     474}
     475        /**
     476         * Return the topic archive title
     477         *
     478         * @since bbPress (r3249)
     479         *
     480         * @global bbPress $bbp The main bbPress class
     481         * @param string $title Default text to use as title
     482         *
     483         * @uses get_page_by_path() Check if page exists at root path
     484         * @uses get_the_title() Use the page title at the root path
     485         * @uses get_post_type_object() Load the post type object
     486         * @uses bbp_get_topic_post_type() Get the topic post type ID
     487         * @uses get_post_type_labels() Get labels for topic post type
     488         * @uses apply_filters() Allow output to be manipulated
     489         *
     490         * @return string The topic archive title
     491         */
     492        function bbp_get_topic_archive_title( $title = '' ) {
     493                global $bbp;
     494
     495                // If no title was passed
     496                if ( empty( $title ) ) {
     497
     498                        // Set root text to page title
     499                        if ( $page = get_page_by_path( $bbp->topic_archive_slug ) ) {
     500                                $title = get_the_title( $page->ID );
     501
     502                        // Default to topic post type name label
     503                        } else {
     504                                $tto    = get_post_type_object( bbp_get_topic_post_type() );
     505                                $title  = $tto->labels->name;
     506                        }
     507                }
     508
     509                return apply_filters( 'bbp_get_topic_archive_title', $title );
    463510        }
    464511
Note: See TracChangeset for help on using the changeset viewer.