• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Genesis Theme Framework a2z

Genesis Theme Framework a2z

WordPress Dynamic API Reference

  • Home
  • Plugins
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / Parsed Source / Parsed: 51145
function genesis_post_date_shortcode( $atts ) {

  $defaults = [
    'after'          => '',
    'before'         => '',
    'format'         => get_option( 'date_format' ),
    'label'          => '',
    'relative_depth' => 2,
  ];

  $atts = shortcode_atts( $defaults, $atts, 'post_date' );

  if ( 'relative' === $atts['format'] ) {
    $display  = genesis_human_time_diff( get_the_time( 'U' ), current_time( 'timestamp' ), $atts['relative_depth'] ); // phpcs:ignore WordPress.DateTime.CurrentTimeTimestamp.Requested -- safe to compare WP to WP timestamps, see https://make.wordpress.org/core/2019/09/23/date-time-improvements-wp-5-3/#comment-37319.
    $display .= ' ' . __( 'ago', 'genesis' );
  } else {
    $display = get_the_time( $atts['format'] );
  }

  $output = sprintf( '<time %s>', genesis_attr( 'entry-time' ) ) . $atts['before'] . $atts['label'] . $display . $atts['after'] . '</time>';

  return apply_filters( 'genesis_post_date_shortcode', $output, $atts );

}
 

Published: 25th November 2019 | Last updated: 3rd April 2020

Primary Sidebar

Information

Source ref: genesis_post_date_shortcode() – Produces the date of post publication.
Parse count / Source file date: 1585909726
MD5 hash: 6be433bc4f9a1cbaa7567466addbb832

Footer

Genesis a2z
Genesis Theme Framework a2z
WordPress Dynamic API Reference
WordPress 5.9.3
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:  genesis.wp-a2z.org
© Copyright Genesis a2z 2014-2022. All rights reserved.


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

  • Home
  • Blog
  • Sitemap
  • Sites