If I have developed a separate HTML page that I wish to include inside my Wordpress site what is the best way of including it? In this case it requires a javascript library or stylesheet that is not by default in my Wordpress theme that would need to be inserted in the tag.

I am aware of the following solutions:


  • To match the site styling I would need to include every css from the theme in the iframe header.
  • If the theme is updated with another script style sheet, this would not be updated in the iframe, maintenance could be arduous.

Editing the theme:

I could add into the various theme files along the lines:

is_single( 'page1' )
add_action( 'wp_head', 'extra_stuff' )

For each post/page I create or change I would have to change the theme files accordingly.

Ideally I would like to be able to do this from within the post editor

Are there any plugins that accomplish this?

2 Answers 2


I found the best solution was to add a custom field, head, and then build a short plugin to add the contents to the head tag:

add_action('wp_head', 'add_HTML_head');
function add_HTML_head(){
    global $post;
        // get custom field for 'head'
        $headHTML = get_post_meta($post->ID, 'head', true);
            echo $headHTML;

I've packaged it up into a simple plugin.

  • If this answers your own question please mark it as the accepted answer.
    – user9447
    Oct 26, 2017 at 17:43

For this kind of situation you can create a custom template for your page, as well as a specific header, for example :

  • template-custompage.php (your page template)
  • header-custompage.php (your custom header, where you call your custom CSS and scripts)

In template-custompage.php, you call your custom header with :

get_header( 'custompage' );

Then create your page as you would normally in the Wordpress editor, and choose your custom page template in the pages attributes block.

Your Answer

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

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