• Dear,

    i am trying to get the date in my wp bakery grid builder.

    so far i have created a shortcode which functions but it echos back te page date.

    <?php
    
       function dotavatiar_function( $format = '', $post = null ) {
        $post = get_post( $post );
     
        if ( ! $post ) {
            return false;
        }
     
        $_format = ! empty( $format ) ? $format : get_option( 'date_format' );
     
        $the_date = get_post_time( $_format, false, $post, true );
     
        /**
         * Filters the date a post was published.
         *
         * @since 3.0.0
         *
         * @param string      $the_date The formatted date.
         * @param string      $format   PHP date format.
         * @param int|WP_Post $post     The post object or ID.
         */
        return apply_filters( 'get_the_date', $the_date, $format, $post );
    };
    add_shortcode('dotiavatar', 'dotavatiar_function');

    I want to get the posts-date. This function i have written above as i said echos the page date not the posts.

    Thank you

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    The correct solution depends on how the code that generates the grid works. I recommend asking through WP Bakery’s dedicated support channel.

    Thread Starter glaukabazi

    (@glaukabazi)

    Unfortunately i am using the wp bakery that my theme provides so i am not able to contact support unless i’ve bought the plugin from them.

    But thank you anyway.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘get_the_date’ is closed to new replies.