How does WordPress add head code to articles? WP plugin optimizes head code

Since in this article "How to Customize Header in WordPress?Install WordPress Footer Header Plugin"IntroducedHeader Footer Code Manager Plugin, currently unable to add PHP code...

Thus, inWordPress pluginSearch the official website and find a WordPress plugin that can add PHP code to headers and footers - Head, Footer and Post Injections plugin.

What is the Head, Footer and Post Injections plugin?

Add PHP/JavaScript/CSS code to the header and footer of a specified article in WordPress

The Head, Footer and Post Injections plugin allows your WordPress site to add the following common codes to the Header without installing more than 10 plugins:

  • Google Analytics
  • Facebook pixel
  • customizetracking code
  • Google DFP tags
  • Google Webmaster/Alexa/Bing/Trade doubler Verification code

All you need to do is enable the Head, Footer and Post Injections pluginCentrally manage code, never againDon't worry about changing your WordPress themeLost added code.

Why install the Head, Footer and Post Injections plugin?

Do you need to insert ad banners above or after your post content?

Yes, using the Head, Footer and Post Injections plugin, you can add code at the top and bottom of an article post or page:

  • in articles and pagestop, bottom and middleadd code;
  • Differentiate between mobile and desktop(You wouldn't show the same ad format on both, would you?);
  • separate post and page configurations;
  • PHP code can be added;
  • Enable shortcodes.
  • just after the open BODY tab
  • in the middle of the post content (using configurable rules)
  • anywhere on the template (with placeholders)

WordPress article optimization head code

On"Head, Footer and Post Injections Plugin"Under the "Advanced Features" tab, you can optimize the head code of WordPress articles:

  1. CSS merged style id removed
  2. CSS merged media removal

WordPress article optimization head code No. 2

The following is from the developer of the Head, Footer and Post Injections pluginArticle introduction :

CSS merged style id removed

  • WordPress has a great feature that we can name "Style Queue".Every plugin that needs to add its style to a page can ask WordPress to "queue" it, and WordPress will add it correctly.
  • But WordPress even adds a unique ID to this CSS, so every module or plugin that tries to merge CSS is usually blocked.Giving a style resource a unique id means someone can reference it, and merging breaks that uniqueness.
  • Usually the id is not used at all, and if removed, CSS merging can happen.For example mod_pagespeed requires the id to be removed otherwise it won't merge the styles.
  • (It also needs to remove compression, so if you use a caching plugin, disable compression when using mod_pagespeed).

CSS merged media removal

  • If you've read the paragraph above, you should know that another CSS link property affects merging, and it's the "media" property. The media attribute is primarily used to add a set of styles to change the appearance of the page when printed, even though there are more options and uses available.
  • Usually all plugins add CSS with the "media" property set to "all", and all of these can be combined.But there are plugins that add CSS to "screen" with media set to "screen", which may or may not be important in your blog (read more about media types here).
  • If it's okay to remove media attributes in your blog, you should benefit from broader style merging.The "print" media type is reserved anyway.

Head, Footer and Post Injections plugin download

Comment

Your email address will not be published. Required fields * Callout

Scroll to Top