'yes' | 'no' | true | false, * 'comments' => 'yes' | 'no' | true | false, * 'post_date' => 'yes' | 'no' | true | false, * 'categories' => 'yes' | 'no' | true | false, * ) */ function blocksy_post_meta( $post_meta_descriptor = [], $args = [] ) { $post_meta_descriptor = array_merge( [ 'author' => false, 'comments' => false, 'post_date' => false, 'updated_date' => false, 'categories' => false, 'author_avatar' => false, 'tags' => false, ], $post_meta_descriptor ); $args = wp_parse_args( $args, [ 'class' => '', 'avatar_size' => '35px', 'labels' => true, 'category_style' => 'simple', 'plain' => false, 'meta_type' => 'simple', 'force_icons' => false, 'date_format' => 'M j, Y', // simple | standard 'tags_format' => 'standard' ] ); if ( ! empty( $args['class'] ) ) { $args['class'] = ' ' . $args['class']; } if ($args['meta_type'] === 'icons') { $args['labels'] = false; } if ($args['meta_type'] === 'icons') { $args['category_style'] = 'simple'; } global $post; if (get_post_type($post) === 'page') { $post_meta_descriptor['comments'] = false; if ($post_meta_descriptor['categories']) { $post_meta_descriptor['categories'] = in_array( 'category', get_object_taxonomies('page') ); } if ($post_meta_descriptor['tags']) { $post_meta_descriptor['tags'] = in_array( 'post_tag', get_object_taxonomies('page') ); } } if ( ! in_array( true, array_values( $post_meta_descriptor ), true ) ) { return ''; } // Author ID global $post; $user_id = $post->post_author; $avatar = ''; if ( $post_meta_descriptor['author_avatar'] ) { $avatar = ' has-avatar'; } $label_output = []; if ($args['labels'] && !$args['plain']) { $label_output = ['data-label' => '']; } $container_attr = array_merge([ 'class' => $args['plain'] ? 'product-categories' : 'entry-meta' . ( $avatar ) . $args['class'], ], $label_output, ( $args['plain'] ? [] : [ 'data-type' => $args['meta_type'] ] )); ob_start(); ?>