[Resolved] Dynamically show date accessed?

Home Forums Support Dynamically show date accessed?

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #131478
    Bill Wade

    Hello,

    Is there a way to replicate this function in the content section?

    <?php echo date_i18n(‘F j, Y’, time()); ?>

    I am trying to dynamically show the date of access in proper format (e.g., APA, Chicago, etc.) to visitors for citation purposes. Any idea how I could do this?

    Thanks.

    #131529
    Tom
    Lead Developer
    Lead Developer

    Where in the content area you wanting to place it?

    #131603
    Bill Wade

    Hello,

    In the the middle of the conten, for example:

    Lorem ipsum dolor sit amet, alii impetus aliquam eu eos, vim legendos perpetua ut. Et eirmod bonorum vis, commodo tritani explicari te duo, quot nullam disputando nec ei. Corpora repudiare quo eu, qui ea offendit euripidis incorrupte. Illum percipit eum an. Eu vel ipsum dicant viderer, natum verear nec cu. Qui decore periculis erroribus ex, mea ea pericula disputando.

    Page was accessed on: <?php echo date_i18n(‘F j, Y’, time()); ?>

    Justo postea vituperatoribus id eos, dolorum constituto delicatissimi eu quo. Tractatos intellegebat concludaturque pri ei. Nullam pertinax incorrupte te sed, deserunt principes ad eum. Ut quaeque perfecto vix, id ius argumentum definitionem, ut dolor phaedrum quo. Inani perpetua mea.

    ——–

    I think the way to do it is through a shortcode. I am fiddling with it right now to see if I can make it work.

    #131605
    Bill Wade

    Something like this for example:

    // Add Shortcode
    function chi_code( $atts ) {
    
    	// Attributes
    	extract( shortcode_atts(
    		array(
    			'echo date_i18n(‘F j, Y’, time())' => '',
    		), $atts )
    	);
    }
    add_shortcode( 'chi', 'chi_code' );

    Maybe…?

    #131608
    Tom
    Lead Developer
    Lead Developer

    Ah, you can try something like this:

    function chi_code( $atts ){
    	return date_i18n('F j, Y', time());
    }
    add_shortcode( 'chi', 'chi_code' );
    #131917
    Bill Wade

    Thanks Tom,

    Worked like a charm.

    #131959
    Tom
    Lead Developer
    Lead Developer
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.