You want to create a new plugin for this. See: http://codex.wordpress.org/Plugin_API/Action_Reference/wp_head
- Create a new file in /wp-content/plugins/ called headerstuff.php (or whatever)
-
Drop the following code in it:
<?php function header_code() { $output .= ""; //code segment echo $output; } add_action('wp_head', 'header_code'); ?>
-
Add your code between the quotation marks on the line starting with “$output”.
- Activate, done!
Related Posts:
- Does WordPress work without a theme?
- Link to specific Customizer section
- How do I change the header image height in Twenty Seventeen?
- When cropping a header image, retain meta data (i.e. name, description, etc.) from original image?
- How to create a new theme from scratch?
- Adding a Template to the Page Attributes Panel for both Posts and Pages?
- How do you change the theme location?
- How do I put my comment form above the comments?
- How can I check for malware in a Theme? [closed]
- Theme Advanced Styles in Visual Editor and Paragraphs
- Want to have the Post editor remembering the last editing position
- Override parent theme translation on child theme
- Forbidden 403 error, permission to access, unable to read htaccess
- Theme of codinghorror.com
- Weird post pagination url redirect
- How to add template to theme in WP
- What is the WordPress Pinecone sitting on top of? [closed]
- Download WordPress.com theme: how?
- Can I rename a theme’s folder and still receive updates?
- Child theme not visible
- Custom theme folder
- Create a dashboard-style site (not WordPress dashboard) – is there a theme? [closed]
- Help with WordPress Query
- Are theme .php files stored in the database?
- Inject widgets from one sidebar into another with PHP
- Execute filter in theme as last
- Why style.css with ?ver=3.9.2 not updating as the one without ?ver=3.9.2?
- An unexpected error occurred. Something may be wrong with WordPress.org
- Updating my free theme delete all my changes [closed]
- Do not show one specific widget on one specific page
- Website redesign – New theme – Help needed
- ‘Add New’ button not present [closed]
- How to style the post previews/links without it affecting the main posts?
- How can we hide the parent’s theme url at the child themes details on a multisite?
- Tips for managing code when developing a parent theme framework
- problem with my my theme “search.php”
- How can I show full text, not summary for the homepage and in categories?
- Wp theme not working well as forgot to create child theme [closed]
- Theming global variables – initializing in index.php but using in header.pho
- Understanding the theme details in style.css
- How to assign custom template to specific products in Woocommerce?
- Need a theme that let the posted content stretched maximum width [closed]
- Copying post thumbnail to custom field
- How to override theme class function to child theme? [closed]
- How to make content area in full width in Twenty Twenty-One theme?
- The requested theme does not exist. Stylesheet is missing – error after changing style.css name to my-styles.css in wp child theme?
- Trying to fix a website that was built with WordPress and then taken off of it
- How to integrate JSS to WordPress
- Re-zipping or extracting theme from wordpress site files
- Can I easily switch themes on a fully built website? [closed]
- How to remove a large ugly space from my wordpress site?
- Moving the search bar to be in menu bar
- Why cant I change the text on this theme?
- How can I add text on top of slideshow? [closed]
- Display Headings on Index page in different font sizes
- Does WP, php, or a current framework (woofoo / genesis, etc). Offer a way to schedule text / bg color changes?
- different theme in one website
- I made new theme directory, why won’t it show up in admin GUI?
- Migrating a website using custom image tags to use featured images instead
- Editing Theme and Moving Servers
- In a specific blog, the K2 theme does not have a Text Widget
- How to push a theme update for a ciustom theme used on multiple independant self hosted sites?
- Removing a widget via theme editor
- theme customizations gone after enabling ssl
- Can’t embed certain youtube videos into theme
- How to customize a section of a widget only on certain pages or page
- How do I get the featured image to sit below the header in the twenty nineteen theme?
- How to use my .mo file in the Divi child theme instead of file in a parent /builder directory?
- How to fix Gutenberg with SiteOrigin page builder deleting content when editing
- Simple filter to change label name of Email Adress to something else
- Basic wordpress search shows no results
- How do I remove search bar that isn’t a widget?
- Show only the beginning of post
- Changing theme folder name disrupts widgets
- WordPress Customazation API section in section
- TwentyFourteen Theme : Changing grid layout
- How can I Update my Theme
- How to allow users to switch to the child theme from front end without plugin?
- Use random theme
- Replacing current theme folder by previous version of the same folder produces “undefined function get_header()” error
- Theme comment callback results nothing
- Does not work bookmarklet in the theme Tagology
- How do I block a subdirectory from WordPress theming?
- How to remove the option data of a theme when that theme is removed?
- Resetting Themes Folder to Default
- Sub-Theme (based on Taxonomies)
- How to Hide Blog Post Author?
- Convert theme to be based on Bootstrap?
- Include root files into header files
- Adding a wp_head hook from an included PHP file
- Deleting Widgets in sidebar in Panthea theme
- Static posts page is not working
- Cannot use some themes within Managed WordPress of Go Daddy [closed]
- How to track your theme usage on the internet?
- How to add Company Logo to Chosen Theme
- What security risk is not having “default” theme?
- Is it possible to dynamically show different themes for different users? [duplicate]
- Why does WP theme not look like promoted? [closed]
- Table of Contents in Left Navbar [closed]
- How do I get rid of the Mindblown and the book recommendations?