• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WordPress a2z

WordPress a2z

WordPress Dynamic API Reference

  • Home
  • Plugins
  • Themes
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / twentytwenty_get_post_meta() – Retrieves the post meta.

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:

101 to 200 of 262
         * Fires before post meta HTML display.
         *
         * Allow output of additional post meta info to be added by child themes and plugins.
         *
         * @since Twenty Twenty 1.0
         * @since Twenty Twenty 1.1 Added the `$post_meta` and `$location` parameters.
         *
         * @param int    $post_id   Post ID.
         * @param array  $post_meta An array of post meta information.
         * @param string $location  The location where the meta is shown.
         *                          Accepts 'single-top' or 'single-bottom'.
         */
        do_action( 'twentytwenty_start_of_post_meta_list', $post_id, $post_meta, $location );

        // Author.
        if ( post_type_supports( get_post_type( $post_id ), 'author' ) && in_array( 'author', $post_meta, true ) ) {

          $has_meta = true;
          ?>
					<li class="post-author meta-wrapper">
						<span class="meta-icon">
							<span class="screen-reader-text"><?php _e( 'Post author', 'twentytwenty' ); ?></span>
							<?php twentytwenty_the_theme_svg( 'user' ); ?>
						</span>
						<span class="meta-text">
							<?php
              printf(
                /* translators: %s: Author name. */
                __( 'By %s', 'twentytwenty' ),
                '<a href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author_meta( 'display_name' ) ) . '</a>'
              );
              ?>
						</span>
					</li>
					<?php

        }

        // Post date.
        if ( in_array( 'post-date', $post_meta, true ) ) {

          $has_meta = true;
          ?>
					<li class="post-date meta-wrapper">
						<span class="meta-icon">
							<span class="screen-reader-text"><?php _e( 'Post date', 'twentytwenty' ); ?></span>
							<?php twentytwenty_the_theme_svg( 'calendar' ); ?>
						</span>
						<span class="meta-text">
							<a href="<?php the_permalink(); ?>"><?php the_time( get_option( 'date_format' ) ); ?></a>
						</span>
					</li>
					<?php

        }

        // Categories.
        if ( in_array( 'categories', $post_meta, true ) && has_category() ) {

          $has_meta = true;
          ?>
					<li class="post-categories meta-wrapper">
						<span class="meta-icon">
							<span class="screen-reader-text"><?php _e( 'Categories', 'twentytwenty' ); ?></span>
							<?php twentytwenty_the_theme_svg( 'folder' ); ?>
						</span>
						<span class="meta-text">
							<?php _ex( 'In', 'A string that is output before one or more categories', 'twentytwenty' ); ?> <?php the_category( ', ' ); ?>
						</span>
					</li>
					<?php

        }

        // Tags.
        if ( in_array( 'tags', $post_meta, true ) && has_tag() ) {

          $has_meta = true;
          ?>
					<li class="post-tags meta-wrapper">
						<span class="meta-icon">
							<span class="screen-reader-text"><?php _e( 'Tags', 'twentytwenty' ); ?></span>
							<?php twentytwenty_the_theme_svg( 'tag' ); ?>
						</span>
						<span class="meta-text">
							<?php the_tags( '', ', ', '' ); ?>
						</span>
					</li>
					<?php

        }

        // Comments link.
        if ( in_array( 'comments', $post_meta, true ) && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {

          $has_meta = true;
          ?>
					<li class="post-comment-link meta-wrapper">
						<span class="meta-icon">
							<?php twentytwenty_the_theme_svg( 'comment' ); ?>
 
« Previous [1] [2] [3] Next »

 View on GitHub View on Trac

Published: 25th November 2019 | Last updated: 21st August 2020

Primary Sidebar

Information

Function name: twentytwenty_get_post_meta
Plugin ref: Twenty Twenty
Version: 1.7
Sourcefile: inc/template-tags.php
File ref: inc/template-tags.php
Deprecated?: No
API Letters: G,M,P,T

Footer

WordPress a2z
WordPress a2z
WordPress Dynamic API Reference
WordPress 5.7. PHP: 7.3.27
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  wp-a2z.org
© Copyright WordPress a2z 2014-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites