Support » Plugin: Parsi Date » Need a conditional for $posts in wpp_fix_post_date function

  • ResolvedPlugin Author Mostafa Soufi

    (@mostafas1990)


    Hello friends,

    Need to be a conditional for $post in wpp_fix_post_date function. always are not in the loop.

    function wpp_fix_post_date( $time, $format = '' ) {
        global $post, $wpp_settings;
    
        // It's seems some plugin like acf does not exits $post.
        if( empty($post) )
            return $time;
    
        if ( empty( $format ) )
            $format = get_option( 'date_format' );
    
        if ( $wpp_settings['conv_dates'] == 'disable' )
            return parsidate( $format, $post->post_date, 'eng' );
        else
            return parsidate( $format, $post->post_date );
    }

    Regards

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Need a conditional for $posts in wpp_fix_post_date function’ is closed to new replies.