• Resolved rscarter1

    (@rscarter1)


    How do I show the date and time of the last import?

    If I figure it out, I’ll post a reply to myself. ??

Viewing 1 replies (of 1 total)
  • Thread Starter rscarter1

    (@rscarter1)

    Answer:

    In functions file add:

    function convertImportTime(?string $import_time, string $format = 'M j, Y @ G:i'): ?string
    {
        if (!$import_time) {
            return null;
        }
    
        return date_i18n(
            __($format, ud_get_wpp_importer()->domain),
            strtotime($import_time)
        ); 
    }
    
    function getImportTime(): ?string
    {
        global $post;
    
        if (!$post) {
            return null;
        }
    
        $import_time = get_post_meta($post->ID, 'wpp_import_time', true);
    
        if (!$import_time) {
            $import_time = $import_time = get_post_meta($post->ID, 'wpp_xml_import', true);
        }
    
        return convertImportTime($import_time);
    }

    In theme template use:

    <?php echo getImportTime(); ?>

Viewing 1 replies (of 1 total)
  • The topic ‘Showing date and time of last import’ is closed to new replies.