You appear to be a bot. Output may be restricted
Description
Retrieves the post meta.
Usage
twentytwenty_get_post_meta( $post_id, $location );
Parameters
- $post_id
- ( int ) optional – The ID of the post.
- $location
- ( string ) optional default: single-top – The location where the meta is shown.
Returns
void
Source
File name: twentytwenty/inc/template-tags.php
Lines:
1 to 100 of 262
function twentytwenty_get_post_meta( $post_id = null, $location = 'single-top' ) { // Require post ID. if ( ! $post_id ) { return; } /** * Filters post types array. * * This filter can be used to hide post meta information of post, page or custom post type * registered by child themes or plugins. * * @since Twenty Twenty 1.0 * * @param array Array of post types */ $disallowed_post_types = apply_filters( 'twentytwenty_disallowed_post_types_for_meta_output', array( 'page' ) ); // Check whether the post type is allowed to output post meta. if ( in_array( get_post_type( $post_id ), $disallowed_post_types, true ) ) { return; } $post_meta_wrapper_classes = ''; $post_meta_classes = ''; // Get the post meta settings for the location specified. if ( 'single-top' === $location ) { /** * Filters post meta info visibility. * * Use this filter to hide post meta information like Author, Post date, Comments, Is sticky status. * * @since Twenty Twenty 1.0 * * @param array $args { * @type string 'author' * @type string 'post-date' * @type string 'comments' * @type string 'sticky' * } */ $post_meta = apply_filters( 'twentytwenty_post_meta_location_single_top', array( 'author', 'post-date', 'comments', 'sticky', ) ); $post_meta_wrapper_classes = ' post-meta-single post-meta-single-top'; } elseif ( 'single-bottom' === $location ) { /** * Filters post tags visibility. * * Use this filter to hide post tags. * * @since Twenty Twenty 1.0 * * @param array $args { * @type string 'tags' * } */ $post_meta = apply_filters( 'twentytwenty_post_meta_location_single_bottom', array( 'tags', ) ); $post_meta_wrapper_classes = ' post-meta-single post-meta-single-bottom'; } // If the post meta setting has the value 'empty', it's explicitly empty and the default post meta shouldn't be output. if ( $post_meta && ! in_array( 'empty', $post_meta, true ) ) { // Make sure we don't output an empty container. $has_meta = false; global $post; $the_post = get_post( $post_id ); setup_postdata( $the_post ); ob_start(); ?> <div class="post-meta-wrapper<?php echo esc_attr( $post_meta_wrapper_classes ); ?>"> <ul class="post-meta<?php echo esc_attr( $post_meta_classes ); ?>"> <?php /**