ID; $aid = $post->post_author; $m = get_the_time('m'); $d = get_the_date('F j'); $y = get_the_time('Y'); $month_url = get_month_link($y, $m); $year_url = get_year_link($y); $date = ''; $date .= ''.$d.', '; $date .= ''.$y.''; $author = ''; if ( function_exists( 'coauthors_posts_links' ) ) { $author .= coauthors_posts_links(null, null, null, null, false); } else { $author .= ''; $author .= get_the_author_meta('display_name', $aid); $author .= ''; } $author .= ''; return '' . $date . ' - ' . $author . ''; } function benjamin_posted_on() { echo benjamin_get_posted_on(); } function benjamin_get_posted_on(){ global $post; $id = get_the_ID(); $m = get_the_time('m'); $d = get_the_date('F j'); $y = get_the_time('Y'); $month_url = get_month_link($y, $m); $year_url = get_year_link($y); $date = ''; $date .= ''.$d.', '; $date .= ''.$y.''; $author = ''; if ( function_exists( 'coauthors_posts_links' ) ) { $author .= coauthors_posts_links(null, null, null, null, false); } else { $author .= ''; $author .= get_the_author(); $author .= ''; } $author .= ''; $output = ''; $output .= '' . $date . ''; $output .= ' - ' . $author . ''; // WPCS: XSS OK. return $output; } /** * Prints HTML with meta information for the categories, tags and comments. */ function benjamin_entry_footer() { global $post; // Hide category and tag text for pages. if ( 'page' !== get_post_type() ) { /* translators: used between list items, there is a space after the comma */ if ( $categories_list = benjamin_get_the_category_list($post->ID) ) { printf( '' . esc_html__( 'Posted in %1$s', 'benjamin' ) . '', $categories_list ); // WPCS: XSS OK. } /* translators: used between list items, there is a space after the comma */ $tags_list = get_the_tag_list( '', esc_html__( ', ', 'benjamin' ) ); if ( $tags_list ) { echo "
"; printf( ' ' . esc_html__( 'Tagged %1$s', 'benjamin' ) . '', $tags_list ); // WPCS: XSS OK. } } if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { echo "
"; echo ' '; /* translators: %s: post title */ comments_popup_link( sprintf( wp_kses( __( 'Leave a Comment on %s', 'benjamin' ), array( 'span' => array( 'class' => array() ) ) ), get_the_title() ) ); echo ''; } edit_post_link( sprintf( /* translators: %s: Name of current post */ esc_html__( 'Edit %s', 'benjamin' ), the_title( '"', '"', false ) ), '
', '' ); } function benjamin_get_the_category_list($id = null) { $post = get_post($id); $post_type = $post->post_type; $is_cat = ($post_type =='post') ? true : false; $terms = $is_cat ? get_the_category($id) : benjamin_get_custom_tax_terms($id, $post_type); $output = ''; $count = 0; foreach($terms as $term): if($term->term_id == 1 && ($term->slug == 'uncategorized') || ($term->name == 'Uncategorized')) continue; $url = $is_cat ? get_category_link($term->term_id) : get_term_link($term->term_id); $output .= ''.$term->name.', '; $count ++; endforeach; if($count == 0) return false; $output = rtrim($output, ', '); return $output; } function benjamin_get_custom_tax_terms($id = null, $post_type = null) { if(!$id) return; if(!$post_type){ $post = get_post($id); $post_type = $post->post_type; } if( !$post_type) return; $terms = array(); $taxonomy_names = get_object_taxonomies( $post_type ); foreach($taxonomy_names as $tax) $terms += wp_get_post_terms($id, $tax); // examine(wp_get_post_terms($id, 'topics')); return $terms; }