• Resolved Josh Robbs

    (@jwrobbs)


    Love the plugin but having some trouble getting it to output the way I want.

    I’m using get_the_date() to pull the publish of posts for single post meta data. It’s working fine for blog posts. But for event posts, it’s pulling the date of the show.

    Any idea how I can grab the date that the event post was published?

    Thanks for the help,

    Josh

Viewing 2 replies - 1 through 2 (of 2 total)
  • I’ve been using this little piece of code to show Date Published on my posts and also works for events, haven’t tried it on locations.. should also work.

    The date might change if you update an event
    Put in your theme’s functions.php, or child theme.

    function jason_moddate($atts) {
    global $post;
    extract(shortcode_atts(array('format' => get_option("date_format") . " " . get_option("time_format")), $atts));
    return date($format, strtotime($post->post_modified));
    }
    add_shortcode('moddate', 'jason_moddate');

    using shorcode [moddate]

    Thread Starter Josh Robbs

    (@jwrobbs)

    Not quite what I was looking for, but it pointed me in the right direction.

    Final functional code for retrieving date published of events created via Events Manager:

        if ( get_post_type() == 'event' ) {
        	global $post;
        	$this_date = mysql2date( get_option( 'date_format' ), $post->post_date );
        	$date = " on ". $this_date.".";
        }
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Getting date event was posted for theme template’ is closed to new replies.