Exemple #1
0
function bp_get_the_project_link($post_id = 0)
{
    $project = bp_get_the_project($post_id);
    if (!$project) {
        return '';
    }
    $url = get_permalink($project);
    $link = sprintf('<a href="%s">%s</a>', $url, get_the_title($project));
    return apply_filters('bp_get_the_project_link', $link, $project);
}
Exemple #2
0
/**
 * Determine the current project context.
 *
 * @return int The project ID
 */
function buggypress_get_context()
{
    if (is_singular(BuggyPress_Project::POST_TYPE)) {
        return get_queried_object_id();
    }
    if (is_singular(BuggyPress_Issue::POST_TYPE)) {
        return bp_get_the_project(get_queried_object_id());
    }
    if ($project_id = get_query_var('issue_project')) {
        return $project_id;
    }
}
 public static function add_parent_project_to_link($post_link, $post = 0, $leavename = FALSE)
 {
     if (strpos('%parent_project%', $post_link) !== FALSE) {
         return $post_link;
     }
     if (is_object($post)) {
         $post_id = $post->ID;
     } else {
         $post_id = $post;
         $post = get_post($post_id);
     }
     $project_slug = _x('none', 'project parent slug', 'buggypress');
     $project_id = bp_get_the_project($post_id);
     if ($project_id) {
         $project_slug = get_page_uri($project_id);
     }
     // put the project slug in place of %parent_project%
     return str_replace('%parent_project%', self::$cpt->slug . '/' . $project_slug . '/', $post_link);
 }