• Resolved whereverpanda

    (@whereverpanda)


    Hi there,

    This is a very nice plugin!

    I’m just a bit of a coding idiot and I would like to remove some of the styling in the e-mail notification that gets sent when an application is submitted.

    I read in an earlier thread that you stated:

    You can override the applicant email template through by using the following hook(sjb_applicant_email_template).

    As someone who has no idea how to do work with hooks and filters, can you possibly help?

    I’m looking to change this:

    $message = '<div style="width:700px; margin:0 auto;  border: 1px solid #95B3D7;font-family:Arial;">'
                    . '<div style="border: 1px solid #95B3D7; background-color:#95B3D7;">'
                    . ' <h2 style="text-align:center;">' . $header_title . '</h2>'
                    . ' </div>'
                    . '<div  style="margin:10px;">'
                    . '<p>' . date("Y/m/d") . '</p>'
                    . '<p>';

    To this:

    $message = '<div style="width:600px; margin:0 auto;  border: 1px solid #ffffff;font-family:Arial;">'
                    . '<div style="border: 1px solid #ffffff; background-color:#ffffff;">'
                    . ' <h2 style="text-align:center;">' . $header_title . '</h2>'
                    . ' </div>'
                    . '<div  style="margin:10px;">'
                    . '<p>' . date("Y/m/d") . '</p>'
                    . '<p>';

    I know I need to do this in my themes functions.php, but I have no idea how to do this.

    Can you possibly help?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello @whereverpanda,
    You can use this filter sjb_email_start_template to override the email template. You can do this by adding this filter in your themes functions.php file.

    add('sjb_email_start_template', 'modify_email_template',10,3 );
    function modify_email_template($message, $notification_receiver, $post_id){
     // paste your code here
    }
    

    Thank you for reaching us out. Let us know if we can assist you further.

    Regards,

    Thread Starter whereverpanda

    (@whereverpanda)

    Hi Ammar,

    Thanks for this, but putting that in functions.php breaks the site with this message:

    Uncaught Error: Call to undefined function add()

    I’ve tried using add_filter instead of add, which doesn’t give an error, but just makes the header disappear from the e-mail completely

    Here is my code. Can you see anything wrong?

    add_filter('sjb_email_start_template', 'modify_email_template',10,3 );
    function modify_email_template($message, $notification_receiver, $post_id){
            $message = '<div style="width:600px; margin:0 auto;  border: 1px solid #ff0000;font-family:Helvetica;">'
                    . '<div style="border: 1px solid #ff0000; background-color:#ff0000;">'
                    . ' <h2 style="text-align:center;">' . $header_title . '</h2>'
                    . ' </div>'
                    . '<div  style="margin:10px;">'
                    . '<p>' . date("Y/m/d") . '</p>'
                    . '<p>';
    }

    Thanks for your quick reply!

    Hi @whereverpanda,

    You forget to return the $message in your code. Please try the below code.

    add_filter('sjb_email_start_template', 'modify_email_template',10,3 );
    function modify_email_template($message, $notification_receiver, $post_id){
            $message = '<div style="width:600px; margin:0 auto;  border: 1px solid #ff0000;font-family:Helvetica;">'
                    . '<div style="border: 1px solid #ff0000; background-color:#ff0000;">'
                    . ' <h2 style="text-align:center;">' . $header_title . '</h2>'
                    . ' </div>'
                    . '<div  style="margin:10px;">'
                    . '<p>' . date("Y/m/d") . '</p>'
                    . '<p>';
    
                return $message;
    }
    

    Let us know if there is still any issue.

    Regards,

    Thread Starter whereverpanda

    (@whereverpanda)

    That did the trick – sorry I’m an absolute idiot when it comes to these hooks and functions!

    Thanks a ton!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Override E-mail Template’ is closed to new replies.