0

I have a template page I have created myself. On it, I add the header used in the WordPress theme using:

get_header();

However, in it, only on this page, I need to add HTML tag. If I add it after the above code, it is not in the section. I do not want to add it to the theme's header, because, as I explained, I do not need this meta tag on other pages. Also, I do not want to copy the whole header in my template's file, as this is duplicate code and it doesn't seem right to me.

1 Answer 1

1

Put the changes in your header.php by using conditional tags.

For example, in your header.php, add something like this:

<?php
    if (is_page_template( 'templates/YOUR_PAGE_TEMPLATE.php' ) ):
        //Your code goes here
    endif;
?>

You can use other conditional tags to suit your needs.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.