• Resolved dayin

    (@dayin)


    I’m using the code below to add a custom subject line to my weekly digests (I got it from another Subscribe2 support thread) and it’s working fine. But I’d like to be able to add the date I send the digest to the subject line as well. I’d prefer not to have to do it manually for each digest I send out. Does anyone know if this is possible?

    <?php
    /*
    Plugin Name: My Digest Subject
    Description: Change the Subject line of the Subscribe2 Digest email.
    Version: 1.0
    Author: Me
    */
    function my_subject($subject) {
    if (strstr($subject, “Digest”) !== false) {
    return “My Custom Subject Heading”;
    }
    }
    add_filter(‘s2_email_subject’, ‘my_subject’);
    ?>

    http://wordpress.org/extend/plugins/subscribe2/

Viewing 3 replies - 1 through 3 (of 3 total)
  • @dayin,

    Just use the PHP date() function to add the current date in your preferred format to the returned subject string.

    Thread Starter dayin

    (@dayin)

    @mattyrob

    Thanks for replying and helping me out. I followed your suggestion and added “. date(‘jS F’);” to the end of the return string. I removed the other “;” on the line and it worked for me. The custom subject line is now showing the current date as well, which is exactly what I was looking for.

    return "My Custom Subject Heading" . date('jS F');

    @dayin,

    I’m pleased to hear you got it working to your satisfaction.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Adding Date to Custom Subject Line’ is closed to new replies.