WordPress.org

Forums

Writing a Plugin: adding information to <head> (2 posts)

  1. techman92
    Member
    Posted 6 years ago #

    is there anyway to add html to just the page or post that uses the plugin rather that adding html to the whole site through the <? wp_head ?> action?

  2. tomontoast
    Member
    Posted 6 years ago #

    You can call wp_head() after you have decided whether the plugin needs to act on that page or post. eg:

    if(is_single()){
      add_action('wp_head', 'plugin_wp_head');
    }
    plugin_wp_head(){
      echo 'bla bla bla';
    }

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.