Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Ben Huson

    (@husobj)

    You could define the following function and use in your theme templates:

    function my_current_user_expire_date(){
    	if ( class_exists( 'Expire_User' ) ) {
    		$u = new Expire_User( get_current_user_id() );
    		echo $u->get_expire_date_display( array(
    			'date_format' => 'M d, Y',
    			'expires_format' => 'Expires %s',
    			'expired_format' => 'Expired %s',
    			'never_expire'   => 'Never Expire',
    		) );
    	}
    }
    Thread Starter Nathan Ingram

    (@nathaningram)

    Ben! Awesome! This is exactly what I needed. For posterity for those coming across this later, I created a shortcode [expire-date] with Ben’s code above:

    // show user expire date shortcode
    
    function my_current_user_expire_date(){
    	if ( class_exists( 'Expire_User' ) ) {
    		$u = new Expire_User( get_current_user_id() );
    		return $u->get_expire_date_display( array(
    			'date_format' => 'M d, Y',
    			'expires_format' => 'Expires %s',
    			'expired_format' => 'Expired %s',
    			'never_expire'   => 'Never Expire',
    		) );
    	}
    }
    add_shortcode('expire-date', 'my_current_user_expire_date');
    prasenjitp04

    (@prasenjitp04)

    This is the exact feature I am also looking for..Can you please also tell me exactly where to insert this code? and how to reach that file? (Question may sound silly as I don’t have much knowledge in coding)

    Plugin Author Ben Huson

    (@husobj)

    In version 0.8 this functionality is built-in as the shortcode [expire_users_current_user_expire_date /]

    Thanks a lot Ben for your support….

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Post Expiration Date on Front End’ is closed to new replies.