I am working on a WordPress site, where there is a Job section. Where a user can apply for a job, that is why I have created a Contact Form to receive the application with Applicant’s Name, email, address & CV’s.

Now When an applicant clicks to apply for a Job advert it takes them to a Contact Form

Example site – https://www.inext.se/job/solution-architect/

Application Contact Form – https://www.inext.se/job-apply-form/?id=6770

Now I am trying to get is the Job/Position Title as the Subject of Contact Form.

enter image description here

So right now I am receiving the Applicant name as a Subject, But instead of this, I want to use the Title of the Job as a Subject.

Which can be found in the class="info_item" <p> Solution Architect</p> as the form message section. As an example- here the title is Solution Architect which means the form subject also should be the same.

I have searched almost everywhere and almost everything and I didn’t find any solution how I can fetch that Information into the form message section!

Do anyone knows any solution how I can use that class Info as the Subject of the form message section of the Contact Form.


Try with this code –

Put below code in your function.php file

function form_title_function(){
  if (isset($_GET["id"])) {
    $post_id = $_GET['id'];
    $title = get_the_title($post_id); 
    echo "<h2>".$title."</h2>";
add_shortcode('form_title', 'form_title_function');

And use the below shortcode to the contact form subject