wordpress

WordPress dynamic URL for the detail page

By June 16, 2020 No Comments

When we save a record for a CPT the slug is already created, it also takes care of the URL being unique. We just need to take advantage of this setup correctly.

When working with CPT the detail page already exists by default. We only need to use it. You can’t just choose a template for the detail page.

First, you need to create a file called single-tutors.php assuming tutors is your CPT.

This would apply the template file to the file.

For our function of get_page_variables instead of using is_page_template use is_singular(‘tutors’)