In my WordPress I have a page template called: single_jobs.php

In the template is shown a contact formular. Linked in the template file like this:

<?php echo do_shortcode( '[contact-form-7 id="207"]' ); ?>

When creating a page on the single.job template it is possible to set a tag. I would like to have the template testing if the tag is on the page, and if it is, it should not be showing the contact form, but instead just a short sentence.

Is this possibly, and how would I implement it. I am a newbie in PHP, so hoping for detailed answers.


Look at has_tag(). It seems that is what you are looking for

You can use it like follow

if( has_tag( 'NAME OF TAG' ) ) {
    // do something if has tag
    // do something else if not have tag

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.