Support

Account

Home Forums General Issues Second slug/template for CPT with ACF

Helping

Second slug/template for CPT with ACF

  • Hello,
    we created an Custom Post Type for our Jobboard with some ACF attached to this custom post type. Displaying the archive pages and single pages works absolutely fine. Now we want to create a link on every single page which opens a submission form on a new tab/window to apply for the job. But every submission form is unique because of the different job names.

    Now I was thinking about creating a second template/slug which gets his informations from the single page/CPT but shows only the apply form with the job name above the form.

    How is this possible? Can I create a second slug for the same custom post type? We are using Divi as Theme and with Divi Theme Builder I could create the template of the form with the variable of the job name.

    Any ideas? Thanks and best regards

  • Just to confirm that I understand correctly, on the job’s page you want a link to apply for the job?

    If that’s the case, why aren’t you passing the post ID of the job as a query variable (e.g. https://yoursite.com/apply-to-jobs/?job=YOUR_JOBS_POST_ID)?

    If you want a secondary slug for your jobs (so the URLs are prettier), it is possible to add an additional endpoint to existing URLs using add_rewrite_endpoint. If you were to go this route you could have a URL that looks like https://yoursite.com/job-a/apply/

    You would then use the template_redirect hook to load a different template that has a form (but you’d still be able to get the original job’s ID) so that you could inject the name of the job in the form.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.