• Daniel

    (@daniel_word_press)


    Hi everyone!
    with “<?php echo get_the_title($ID); ?>” I can see the Post Title in the sidebar but I can’t figure out how to see it into the email form that arrives to users.

    I’m working at a directory website where the Post Title is the ad name, so users must receive by email even the Ad name when someone asks for information. The theme I use has a generic email form.

    Anyone can help? Thank you in advance! ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • esmi

    (@esmi)

    What are you using to send out these emails? A plugin?

    Thread Starter Daniel

    (@daniel_word_press)

    No, unfortunately is a function inside the theme. Here is the section of the code that has the email form:

    // Contact form submit ajax
    function cs_contact_form_submit() {
        define('WP_USE_THEMES', false);
        $subject = '';
        $cs_contact_error_msg = '';
        $subject_name = 'Subject';
        foreach ($_REQUEST as $keys=>$values) {
            $$keys = $values;
        }
        if(isset($phone) && $phone <> ''){
            $subject_name = 'Phone';
             $subject = $phone;
        }
    
        $bloginfo     = get_bloginfo();
        $subjecteEmail = "(" . $bloginfo . ") Contact Form Received";
        $message = '
                <table width="100%" border="1">
                  <tr>
                    <td width="100"><strong>'.__('Name:', 'dir').'</strong></td>
                    <td>'.esc_html($contact_name).'</td>
                  </tr>
                  <tr>
                    <td><strong>'.__('Email:', 'dir').'</strong></td>
                    <td>'.sanitize_email($contact_email).'</td>
                  </tr>
                  <tr>
                    <td><strong>'.esc_html($subject_name).':</strong></td>
                    <td>'.esc_html($subject).'</td>
                  </tr>
                  <tr>
                    <td><strong>'.__('Message:', 'dir').'</strong></td>
                    <td>'.esc_html($contact_msg).'</td>
                  </tr>
                  <tr>
                    <td><strong>IP Address:</strong></td>
                    <td>'.esc_html($_SERVER["REMOTE_ADDR"]).'</td>
                  </tr>
                </table>';
    
            $headers = "From: " . $contact_name . "\r\n";
            $headers .= "Reply-To: " . $contact_email . "\r\n";
            $headers .= "Content-type: text/html; charset=utf-8" . "\r\n";
            $headers .= "MIME-Version: 1.0" . "\r\n";
            $attachments = '';
    
            if( wp_mail( $cs_contact_email, $subjecteEmail, $message, $headers, $attachments ) ) {
                $json    = array();
                $json['type']    = "success";
                $json['message'] = '<p>'.cs_textarea_filter($cs_contact_succ_msg).'</p>';
            } else {
                $json['type']    = "error";
                $json['message'] = '<p>'.cs_textarea_filter($cs_contact_error_msg).'</p>';
            };
    
        echo json_encode( $json );
    die();
    }

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been damaged by the forum’s parser.]

    esmi

    (@esmi)

    I’m sorry but as you appear to be using a non-WPORG theme, you need to seek support from the theme’s developers – paid or otherwise. We only support themes downloaded from www.remarpro.com here.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Post title in the Email’ is closed to new replies.