How to add date to templates?

Hello;

I'm creating a custom enewsletter template by copying and modifying one of the included templates. I noticed in the existing template screenshots that there is a 'sent date' displayed, usually in the header. But when I test the templates out, there is no date. How do I get the the 'date sent' to be automatically added to the template when I send?

  • 3SixtyEvolve
    • New Recruit

    Hi 3RING

    Welcome to the WPMU DEV Community and thank you for being a member.

    If you've amended one of the e-Newsletter Plugin templates, I think the best would be to place the below java script code in the template.html

    <script type="text/javascript">
    <!--
    var currentTime = new Date()
    var month = currentTime.getMonth() + 1
    var day = currentTime.getDate()
    var year = currentTime.getFullYear()
    document.write(month + "/" + day + "/" + year)
    //-->
    </script>

    This might solve your problem - hope it was helpful.

    Looking forward to your feedback.

    Have a good day!

    GinaB

  • Henk
    • Design Lord, Child of Thor

    While you are at it you might add a metafield in the settings where a user could enter the text to display in case there is a link to an online version.
    And then a field to enter the url of the online version

    Grtz.

  • 3RING
    • Design Lord, Child of Thor

    Thanks GinaB - this worked great. I did modify it a bit to make the date appear as "March 8, 2012" vs. "3/8/2012":

    <script type="text/javascript">
    										<!--
    										var currentTime = new Date()
    										var month = currentTime.getMonth() + 1
    										var day = currentTime.getDate()
    										var year = currentTime.getFullYear()
    										if (month == 1) month = 'January';
    										if (month == 2) month = 'February';
    										if (month == 3) month = 'March';
    										if (month == 4) month = 'April';
    										if (month == 5) month = 'May';
    										if (month == 6) month = 'June';
    										if (month == 7) month = 'July';
    										if (month == 8) month = 'August';
    										if (month == 9) month = 'September';
    										if (month == 10) month = 'October';
    										if (month == 11) month = 'November';
    										if (month == 12) month = 'December';
    										document.write(month + "&nbsp;" + day + ",&nbsp;" + year)
    										//-->
    										</script>

    Thanks again!

  • 3RING
    • Design Lord, Child of Thor

    @Andrey, where can we make suggestions for plugin improvements? Simple stuff like adding the date to templates, but also making members list searchable, as well as making the 'Member Groups' on the Member Groups page clickable so that they link to a list of all members within that group. Simple stuff to make the user management more friendly.

    Thanks for a great plugin mate! CHEERS!

  • Cole
    • The Incredible Code Injector

    Hey 3RING,

    Sorry for the delay in getting this looked into.

    Javascript in email delivery is still a no-no on most platforms. That is why it will work in preview mode but not for the real deal. I'll be adjusting the plugin to provide a shortcode of sorts to handle printing a date as well as some other updates.

    Thanks!
    Cole

  • 3SixtyEvolve
    • New Recruit

    Hi 3RING

    I believe the Developer is still working on the next version that will include the adjustments that you need. So in the meantime I will resolve this thread, but please don't hesitate to reopen it if you still require additional feedback from our Support Team. Just select the 'Mark as Not Resolved (re-open)' box below the post area (otherwise we might miss your new post).

    All the best!

    Gina

  • Cole
    • The Incredible Code Injector

    The latest version has date support for your content and templates. Simply add {DATE} anywhere in your templates or directly in your content editor. The date formatting display will use the settings in your WordPress Settings -> General Menu

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.