예제 #1
0
/**
 * Get single post permalink
 * 
 * @param type $post_id
 * @return type
 */
function buddyblog_get_post_url($post_id)
{
    $bp = buddypress();
    $id_or_slug = '';
    $post = get_post($post_id);
    if (get_post_type($post) != buddyblog_get_posttype()) {
        return get_permalink($post_id);
    }
    if (buddyblog_use_slug_in_permalink()) {
        $id_or_slug = $post->post_name;
    } else {
        $id_or_slug = $post->ID;
    }
    return bp_core_get_user_domain($post->post_author) . $bp->buddyblog->slug . '/' . BUDDYBLOG_ARCHIVE_SLUG . '/' . $id_or_slug . '/';
}
예제 #2
0
/**
 * Are we viewing the single post listing on user profile?
 * @return type 
 */
function buddyblog_is_single_post()
{
    $action = bp_current_action();
    $post_id = 0;
    //make sure
    //check the strategy
    if (buddyblog_use_slug_in_permalink()) {
        $slug = bp_action_variable(0);
        $post_id = buddyblog_get_post_id_from_slug($slug);
    } else {
        $post_id = intval(bp_action_variable(0));
    }
    if (bp_is_buddyblog_component() && $action == BUDDYBLOG_ARCHIVE_SLUG && !empty($post_id)) {
        return true;
    }
    return false;
}