astra_breadcrumb_get_bbpress_items( array $args = array() )
Gets the items for the breadcrumb item if bbPress is installed.
Description
Parameters
- $args
-
(array) (Optional) Mixed arguments for the menu.
Default value: array()
Return
(array) List of items to be shown in the item.
Source
File: addons/advanced-headers/classes/astra-breadcrumbs.php
function astra_breadcrumb_get_bbpress_items( $args = array() ) {
$item = array();
$post_type_object = get_post_type_object( bbp_get_forum_post_type() );
if ( ! empty( $post_type_object->has_archive ) && ! bbp_is_forum_archive() ) {
$item[] = '<span class="ast-breadcrumbs-link-wrap" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"><a itemprop="item" rel="v:url" property="v:title" href="' . get_post_type_archive_link( bbp_get_forum_post_type() ) . '"><span itemprop="name">' . bbp_get_forum_archive_title() . '</span></a></span>';
}
if ( bbp_is_forum_archive() ) {
$item[] = bbp_get_forum_archive_title();
} elseif ( bbp_is_topic_archive() ) {
$item[] = bbp_get_topic_archive_title();
} elseif ( bbp_is_single_view() ) {
$item[] = bbp_get_view_title();
} elseif ( bbp_is_single_topic() ) {
$topic_id = get_queried_object_id();
$item = array_merge( $item, astra_breadcrumb_get_parents( bbp_get_topic_forum_id( $topic_id ) ) );
if ( bbp_is_topic_split() || bbp_is_topic_merge() || bbp_is_topic_edit() ) {
$item[] = '<span class="ast-breadcrumbs-link-wrap" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"><a itemprop="item" rel="v:url" property="v:title" href="' . bbp_get_topic_permalink( $topic_id ) . '"><span itemprop="name">' . bbp_get_topic_title( $topic_id ) . '</span></a></span>';
}
if ( bbp_is_topic_split() ) {
$item[] = __( 'Split', 'astra-addon' );
} elseif ( bbp_is_topic_merge() ) {
$item[] = __( 'Merge', 'astra-addon' );
} elseif ( bbp_is_topic_edit() ) {
$item[] = __( 'Edit', 'astra-addon' );
}
} elseif ( bbp_is_single_reply() ) {
$reply_id = get_queried_object_id();
$item = array_merge( $item, astra_breadcrumb_get_parents( bbp_get_reply_topic_id( $reply_id ) ) );
if ( ! bbp_is_reply_edit() ) {
$item[] = bbp_get_reply_title( $reply_id );
} else {
$item[] = '<span class="ast-breadcrumbs-link-wrap" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"><a itemprop="item" rel="v:url" property="v:title" href="' . esc_url( bbp_get_reply_url( $reply_id ) ) . '"><span itemprop="name">' . bbp_get_reply_title( $reply_id ) . '</span></a></span>';
$item[] = __( 'Edit', 'astra-addon' );
}
} elseif ( bbp_is_single_forum() ) {
$forum_id = get_queried_object_id();
$forum_parent_id = bbp_get_forum_parent( $forum_id );
if ( 0 !== $forum_parent_id ) {
$item = array_merge( $item, astra_breadcrumb_get_parents( $forum_parent_id ) );
}
$item[] = bbp_get_forum_title( $forum_id );
} elseif ( bbp_is_single_user() || bbp_is_single_user_edit() ) {
if ( bbp_is_single_user_edit() ) {
$item[] = '<span class="ast-breadcrumbs-link-wrap" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"><a itemprop="item" rel="v:url" property="v:title" href="' . esc_url( bbp_get_user_profile_url() ) . '"><span itemprop="name">' . bbp_get_displayed_user_field( 'display_name' ) . '</span></a></span>';
$item[] = __( 'Edit', 'astra-addon' );
} else {
$item[] = bbp_get_displayed_user_field( 'display_name' );
}
}
return apply_filters( 'astra_breadcrumb_get_bbpress_items', $item, $args );
}
Expand full source code Collapse full source code View on Trac
Changelog
| Version | Description |
|---|---|
| 1.0.0 | Introduced. |