You want to hook into the Header code using something like this:
add_action('wp_head','hook_javascript');
function hook_javascript() {
if (is_single('123')) {
$output="<script> enter your script here </script>";
echo $output;
}
}
More information available here: https://codex.wordpress.org/Plugin_API/Action_Reference/wp_head
Related Posts:
- How to use a svg as custom header?
- How to add text to header below title but above nav
- Different Header Files WordPress
- Remove an uploaded header image
- Is there a way of registering a default logo image for custom-logo?
- Want to create Custom Header based on Geo Location
- Add additional upload field to Custom Header page
- Change position of header image with default 2019 theme
- Include different scripts and styles for two separate custom headers?
- Different header image ‘Home’ and Pages
- Add credit to get_custom_header in alt
- Custom page html headings plugin?
- I want to add my website name in wordpress source code like this
- My custom header does not change the header image height and width
- Embed Form In Header
- Include an infogr.am link in header of twenty seventeen theme
- Disable header banner on specific Posts
- How to add custom header to Twenty seventeen single post in wordpress
- Trying to put text and links into a header
- Child theme does not override parent theme values (custom-header)
- WordPress 4.4.2, _s starter theme, problems with custom default header
- Add a wrapper in the header
- How to create a custom header?
- How to display the link that says “Edit Header Image” on header image
- How to get the custom header image’s alt text?
- When cropping a header image, retain meta data (i.e. name, description, etc.) from original image?
- Adding custom fields to the header.php
- Additional Option on Custom Header admin
- How can I add a custom header to a custom template in a plugin without using the theme folders
- How to Handle CSS for Multiple Header header.php Files?
- Get a sidebar at the top of the page
- add_theme_support( ‘custom-header’ ) does not add option menu in dashboard
- Display different header images based on current page
- How to change default header image dimensions in twentyfourteen child theme?
- How to change the height of featured image in Twenty Eleven child theme
- Mysterious HTTP 404 header in my own scripts
- What is the advantage of using header-catname.php over is_category(‘catname’);?
- adding meta data using plugin to top of head
- Show Different Header on a Specific Post ID
- Change the location of add_theme_support( ‘custom-header’ ) in the customizer
- add_theme_support(‘custom-header’) does not add the option to customize
- Header Slideshow [duplicate]
- Modify wp-admin page header ‘viewport’ meta data
- How to insert a Button or custom text on twentyseventeen header
- Want to make header and footer CMS driven sothat Editors can modify its content from wordpress admin section
- From where the header-text can be changed in WordPress custom header?
- Why I am getting Parse error: syntax error when I use ‘wp_is_mobile’?
- Create mobile navigation header with settings integration
- Using website header, menu and footer on WordPress blog
- Headers Content-Security-Policy CSP Major Issue
- Remove elementor header and display default theme header
- How to output php between header and woocommerce container
- My menu bar dissapeared with autooptimize [closed]
- Which header is served
- Different banner for different section
- How to change header image size in custom themes
- Skeleton Child Theme Add Icon Bar to Header Flex Grid
- Header and nav menu problem on Thesis site [closed]
- Additional custom header image
- Best practice to update the file header.php
- Insert HTML in post, below nav bar but above content?
- WordPress add script with custom type (x-jquery-tmpl)
- header_image not returning header image url
- Adding other links on header than LinkedIn, Facebook, Youtube etc
- get_header() in backend – but keep JavaScript and CSS files
- How to remove WP Title Tag?
- where to change text for header?
- Custom headers in WordPress, are there also custom footers?
- How to set “lang” attribute for post/page title?
- How to change the background color of my header dynamically based on a Custom Posts types color value?
- Conditional Custom Image Header
- Page header menu links change
- navigation doesn’t work in custom header.php
- trouble calling different header.php for home.php
- My theme header is stuck on a low resolution image?
- create a button in the header of the mobile menu in the middle of the logo and the menu accordion
- Design Header meta on single posts wordpress
- WordPress theme header.php should I add title meta?
- Add helper text in custom-header section in admin
- Where is the Javascript attribute window._wpCustomHeaderSettings defined?
- If i use a child theme to add new code blocks to header.php, how does it get inserted in the right place in parent’s header.php?
- How do I remove header/page-title image in farvis theme? [closed]
- Conditional Site Logo(Category Based)
- Different custom header video on different pages
- How to disable site title and description when custom header is uploaded on the customizer?
- Social icons on my index page don’t take visitor to specific site(s) [closed]
- accessibility of an object created in a plugin, from the header
- Where is the stylesheet code?
- Adding header function to theme
- Dynamic Title for custom post types
- Display the current post author and his url in the post header
- Trouble with responsivitizing my twentythirteen header
- Set header for default posts page?
- header specific meta box result detect url
- Creating a custom header
- How can I add a google play badge to my header and footer?
- How to laod wp_enqueue_style to another header i created my self
- How can I customize the size of the header of my theme?
- How to implement a custom sliding banner? [closed]
- Image is very blurry