コード例 #1
0
function bp_the_topic_object_slug() {
	echo bp_get_the_topic_object_slug();
}
コード例 #2
0
/**
 * Return the permalink for the current topic in the loop.
 *
 * @return string Permalink for the current topic.
 */
function bp_get_the_topic_permalink()
{
    global $forum_template, $bp;
    // The topic is in a loop where its parent object is loaded
    if (bp_get_the_topic_object_slug()) {
        $permalink = trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . bp_get_the_topic_object_slug() . '/forum');
        // We are viewing a single group topic, so use the current item
    } elseif (bp_is_group_forum_topic()) {
        $permalink = trailingslashit(bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . bp_current_item() . '/forum');
        // We are unsure what the context is, so fallback to forum root slug
    } elseif (bp_is_single_item()) {
        $permalink = trailingslashit(bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/' . bp_current_item());
        // This is some kind of error situation, so use forum root
    } else {
        $permalink = trailingslashit(bp_get_root_domain() . '/' . bp_get_forums_root_slug());
    }
    return apply_filters('bp_get_the_topic_permalink', trailingslashit($permalink . 'topic/' . $forum_template->topic->topic_slug));
}
コード例 #3
0
/**
 * Return the permalink for the current topic in the loop.
 *
 * @since 1.0.0
 *
 * @return string Permalink for the current topic.
 */
function bp_get_the_topic_permalink()
{
    global $forum_template;
    // The topic is in a loop where its parent object is loaded.
    if (bp_get_the_topic_object_slug()) {
        $permalink = trailingslashit(bp_get_groups_directory_permalink() . bp_get_the_topic_object_slug() . '/forum');
        // We are viewing a single group topic, so use the current item.
    } elseif (bp_is_group_forum_topic()) {
        $permalink = trailingslashit(bp_get_groups_directory_permalink() . bp_current_item() . '/forum');
        // We are unsure what the context is, so fallback to forum root slug.
    } elseif (bp_is_single_item()) {
        $permalink = trailingslashit(bp_get_root_domain() . '/' . bp_get_forums_root_slug() . '/' . bp_current_item());
        // This is some kind of error situation, so use forum root.
    } else {
        $permalink = trailingslashit(bp_get_root_domain() . '/' . bp_get_forums_root_slug());
    }
    /**
     * Filters the permalink for the current topic in the loop.
     *
     * @since 1.0.0
     *
     * @param string $value Permalink for the current topic in the loop.
     */
    return apply_filters('bp_get_the_topic_permalink', trailingslashit($permalink . 'topic/' . $forum_template->topic->topic_slug));
}