@@ 768-792 (lines=25) @@ | ||
765 | * |
|
766 | * @return html |
|
767 | */ |
|
768 | static function get_project_type( $post_id ) { |
|
769 | $project_types = get_the_terms( $post_id, self::CUSTOM_TAXONOMY_TYPE ); |
|
770 | ||
771 | // If no types, return empty string |
|
772 | if ( empty( $project_types ) || is_wp_error( $project_types ) ) { |
|
773 | return; |
|
774 | } |
|
775 | ||
776 | $html = '<div class="project-types"><span>' . __( 'Types', 'jetpack' ) . ':</span>'; |
|
777 | $types = array(); |
|
778 | // Loop thorugh all the types |
|
779 | foreach ( $project_types as $project_type ) { |
|
780 | $project_type_link = get_term_link( $project_type, self::CUSTOM_TAXONOMY_TYPE ); |
|
781 | ||
782 | if ( is_wp_error( $project_type_link ) ) { |
|
783 | return $project_type_link; |
|
784 | } |
|
785 | ||
786 | $types[] = '<a href="' . esc_url( $project_type_link ) . '" rel="tag">' . esc_html( $project_type->name ) . '</a>'; |
|
787 | } |
|
788 | $html .= ' '.implode( ', ', $types ); |
|
789 | $html .= '</div>'; |
|
790 | ||
791 | return $html; |
|
792 | } |
|
793 | ||
794 | /** |
|
795 | * Displays the project tags that a project belongs to. |
|
@@ 799-823 (lines=25) @@ | ||
796 | * |
|
797 | * @return html |
|
798 | */ |
|
799 | static function get_project_tags( $post_id ) { |
|
800 | $project_tags = get_the_terms( $post_id, self::CUSTOM_TAXONOMY_TAG ); |
|
801 | ||
802 | // If no tags, return empty string |
|
803 | if ( empty( $project_tags ) || is_wp_error( $project_tags ) ) { |
|
804 | return false; |
|
805 | } |
|
806 | ||
807 | $html = '<div class="project-tags"><span>' . __( 'Tags', 'jetpack' ) . ':</span>'; |
|
808 | $tags = array(); |
|
809 | // Loop thorugh all the tags |
|
810 | foreach ( $project_tags as $project_tag ) { |
|
811 | $project_tag_link = get_term_link( $project_tag, self::CUSTOM_TAXONOMY_TYPE ); |
|
812 | ||
813 | if ( is_wp_error( $project_tag_link ) ) { |
|
814 | return $project_tag_link; |
|
815 | } |
|
816 | ||
817 | $tags[] = '<a href="' . esc_url( $project_tag_link ) . '" rel="tag">' . esc_html( $project_tag->name ) . '</a>'; |
|
818 | } |
|
819 | $html .= ' '. implode( ', ', $tags ); |
|
820 | $html .= '</div>'; |
|
821 | ||
822 | return $html; |
|
823 | } |
|
824 | ||
825 | /** |
|
826 | * Displays the author of the current portfolio project. |