shopp_product_date_column_time

filters the published date/time displayed in the Product editor.

add_filter( 'shopp_product_date_column_time', [callback] )

@param string $time the published date/time displayed in the Product editor
@param Product $Product the Product object of the currently displayed Product

Description

filters the published date/time displayed in the Product editor.

Example

// register filter callback
add_filter('shopp_product_date_column_time', 'shopp_product_date_column_time_fltr', 10, 2);

// create filter function
function shopp_product_date_column_time_fltr( $time, $Product ) {
    // If the product is published
    // you can process how you want the publish time to be displayed
    if ( __('Unpublished') != $time) {  
        $t_time = get_the_time(__('Y/m/d g:i:s A'));
        $m_time = $Product->publish;
        $time = get_post_time('G', true, $Product->id);
        $time_diff = time() - $time;

        if ( $time_diff > 0 && $time_diff < 24*60*60 )
            $time = sprintf( __('%s ago'), human_time_diff( $time ) );
        else
            $time = date(__('Y/m/d'), $m_time);
    }

    return $time;
}

See Also

You must be logged in to post a comment.

© Ingenesis Limited. Shopp™ is a registered trademark of Ingenesis Limited.

Skip to toolbar