|
@@ 668-692 (lines=25) @@
|
| 665 |
|
* |
| 666 |
|
* @return html |
| 667 |
|
*/ |
| 668 |
|
static function get_project_type( $post_id ) { |
| 669 |
|
$project_types = get_the_terms( $post_id, self::CUSTOM_TAXONOMY_TYPE ); |
| 670 |
|
|
| 671 |
|
// If no types, return empty string |
| 672 |
|
if ( empty( $project_types ) || is_wp_error( $project_types ) ) { |
| 673 |
|
return; |
| 674 |
|
} |
| 675 |
|
|
| 676 |
|
$html = '<div class="project-types"><span>' . __( 'Types', 'jetpack' ) . ':</span>'; |
| 677 |
|
$types = array(); |
| 678 |
|
// Loop thorugh all the types |
| 679 |
|
foreach ( $project_types as $project_type ) { |
| 680 |
|
$project_type_link = get_term_link( $project_type, self::CUSTOM_TAXONOMY_TYPE ); |
| 681 |
|
|
| 682 |
|
if ( is_wp_error( $project_type_link ) ) { |
| 683 |
|
return $project_type_link; |
| 684 |
|
} |
| 685 |
|
|
| 686 |
|
$types[] = '<a href="' . esc_url( $project_type_link ) . '" rel="tag">' . esc_html( $project_type->name ) . '</a>'; |
| 687 |
|
} |
| 688 |
|
$html .= ' '.implode( ', ', $types ); |
| 689 |
|
$html .= '</div>'; |
| 690 |
|
|
| 691 |
|
return $html; |
| 692 |
|
} |
| 693 |
|
|
| 694 |
|
/** |
| 695 |
|
* Displays the project tags that a project belongs to. |
|
@@ 699-723 (lines=25) @@
|
| 696 |
|
* |
| 697 |
|
* @return html |
| 698 |
|
*/ |
| 699 |
|
static function get_project_tags( $post_id ) { |
| 700 |
|
$project_tags = get_the_terms( $post_id, self::CUSTOM_TAXONOMY_TAG ); |
| 701 |
|
|
| 702 |
|
// If no tags, return empty string |
| 703 |
|
if ( empty( $project_tags ) || is_wp_error( $project_tags ) ) { |
| 704 |
|
return false; |
| 705 |
|
} |
| 706 |
|
|
| 707 |
|
$html = '<div class="project-tags"><span>' . __( 'Tags', 'jetpack' ) . ':</span>'; |
| 708 |
|
$tags = array(); |
| 709 |
|
// Loop thorugh all the tags |
| 710 |
|
foreach ( $project_tags as $project_tag ) { |
| 711 |
|
$project_tag_link = get_term_link( $project_tag, self::CUSTOM_TAXONOMY_TYPE ); |
| 712 |
|
|
| 713 |
|
if ( is_wp_error( $project_tag_link ) ) { |
| 714 |
|
return $project_tag_link; |
| 715 |
|
} |
| 716 |
|
|
| 717 |
|
$tags[] = '<a href="' . esc_url( $project_tag_link ) . '" rel="tag">' . esc_html( $project_tag->name ) . '</a>'; |
| 718 |
|
} |
| 719 |
|
$html .= ' '. implode( ', ', $tags ); |
| 720 |
|
$html .= '</div>'; |
| 721 |
|
|
| 722 |
|
return $html; |
| 723 |
|
} |
| 724 |
|
|
| 725 |
|
/** |
| 726 |
|
* Displays the author of the current portfolio project. |