• Resolved scox1

    (@scox1)


    Can it be a setting to show the expiration date of a classified?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    by default there is no such option, but you can display the expiration date on the Ad details page below the location by adding the code below in your (child) theme functions.php file

    
    add_filter( "adverts_tpl_single_details", function($post_id) {
        ?>
        <div class="adverts-grid-row">
            <div class="adverts-grid-col adverts-col-30">
                <span class="adverts-round-icon adverts-icon-calendar"></span>
                <span class="adverts-row-title"><?php _e("Expires", "wpadverts") ?></span>
            </div>
            <div class="adverts-grid-col adverts-col-65">
                <?php $exp_time = get_post_meta( $post_id, "_expiration_date", true ); ?>
                <?php if( $exp_time ): ?>
                <?php echo date_i18n( get_option( "date_format" ), $exp_time ) ?>
                <?php else: ?>
                Never
                <?php endif; ?>
            </div>
        </div>
        <?php
    } );
    
    Thread Starter scox1

    (@scox1)

    Thank you! I’ve added this to my child theme and it works great!

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

The topic ‘Showing Expiration Date’ is closed to new replies.