Code for the Header and Footer

  • specifics
  • Observations
  • Advancement
  • a brief description

    It could be in the <head> section (site verification code for various services, custom styles, meta or Webfont link), just before or after the <body> section (pixel tracking, analytics, or heatmap code), or just after the <body> section (pixel tracking, analytics, or heatmap code). Even if you are not a programmer, the Head & Footer Code plugin allows you to add custom code snippets (JavaScript, CSS, or HTML) to the page.

    In the WordPress Dashboard, go to Tools → Head & Footer Code. Add custom code to the HEAD, BODY, or FOOTER sections, depending on your needs.

    If your WordPress shows the most recent blog posts on the homepage, you can add specific code only for the homepage on Tools → Head & Footer Code (on the Homepage in Blog Posts mode, there will be sections Head, body, and footer code).

    Use the article-specific Metabox while editing a post, page, or custom post type to insert custom code specific to that article (post, page, or custom post type) (see Screenshots). Choose whether the code appends to or replaces the site-wide code defined in Tools → Head & Footer Code.

    Instead, global code is used. Individual categories, tags, and custom taxonomies (category, tag, and custom taxonomy listing, individual category, tag, and custom taxonomies) do not have a unique code.

    Hooking into the WordPress hooks wp_head, wp_footer, and wp_body_open accomplishes this feat.

    There are a variety of code snippets that can be used, including but not limited to:

    • Google Analytics is a tool that allows you to track
    • Google Tag Manager is a tool that allows you to manage your
    • Conversions from Google Ads
    • Facebook Pixel is a tool that allows you to see
    • If you’re looking for a unique way to
    • Story in its entirety
    • Verification of Google’s website
    • Verification of the Bing site
    • Site verification by Yandex
    • Verification of the site via Alexa

    Is it working or is it broken?

    We will make every effort to resolve the problem as quickly as possible. If Head & Footer Code does not work on your WordPress project, please let us know by creating a new support ticket in the Community Forum and describing the problem and how to reproduce it.

    Please review Head & Footer Code if you find it useful for your project.

    Characteristics

    • Set custom content for the head page section (before the </head>) on a site-wide basis.
    • – Requires WordPress 5.2! Set site-wide custom content for the body section (after the <body>)
    • Set custom content for the footer page section (before the </body>) on a site-wide basis.
    • If the Homepage mode is set to Blog Posts, set a custom code for the head, body, and/or footer that is specific to the homepage. [NEW in version 1.2]
    • Set custom code for the head page section (before the </head>) that is specific to the article.
    • Set custom code for the body section of an article (after the <body>) – Requires WordPress 5.2!
    • Set custom content for the footer page section (before the </body>) that is specific to the article.
    • Choose the order in which printed custom code appears in the head, body, and footer sections (lower numbers indicate distance from </head> and </body> and proximity to <body>, while higher numbers indicate distance from <body> and proximity to <body>).
    • Select which post types will have article-specific head, body, and footer fields enabled.
    • Choose whether to append article-specific head, body, and footer code to site-wide code or to replace site-wide code.
    • If an article has defined any article-specific custom code, look at the Posts/Pages/Custom Post Types listing. [NEW in version 1.2.1]
    • Tools > Head & Footer Code has a site-wide section.
    • If the WP_DEBUG constant in wp-config.php is set to true, you’ll see site-wide and article-specific entries wrapped in comments in the page source code.
    • Multisite is possible.
    • PHP 8 is now available!

    The HEAD, BODY, and FOOTER code and behavior for each post/page/custom post type is saved in the post meta _auhfc. When you uninstall the program, this information is removed from the database. WordPress option auhfc_settings saves general settings (HEAD, BODY, FOOTER global code and priority, Homepage code and behavior).

    Photographs

    • In the Plugin search results, look for the Head & Footer Code box.
    • Site-wide, Homepage, and Article Post Types settings page
    • Metabox for each article
    • Example of custom code in the HEAD section (site-wide with article-specific appended code)
    • Example of custom code in the BODY section (site-wide with article-specific appended code)
    • Example of custom code in the FOOTER section (site-wide with article-specific appended code)
    • Example of Head & Footer Code column on Pages listing, used to determine which pages have custom code set, which one, and what mode is selected.

    Constructing

    The Head & Footer Code is as simple to install as any other WordPress plugin.

    This is standard procedure.

    1. Go to Plugins → Add New in the WordPress Dashboard.
    2. Wait for the moment after entering the head footer code into the Search plugins… field.
    3. Click the Install Now button next to Head & Footer Code.
    4. After the installation is complete, click the Activate button.
    5. Head & Footer Code can be found in the Tools → Head & Footer Code section.
    6. In the target section, paste the desired code.

    Procedure for FTP

    1. To get the Head & Footer Code installation package, click the Download button.
    2. On your local computer, unzip the archive head-footer-code.zip.
    3. Upload the entire head-footer-code directory to your server’s /wp-content/plugins/ directory.
    4. Go to Plugins → Installed Plugins in the WordPress Dashboard and click the Activate link for the Head & Footer Code plugin.
    5. Head & Footer Code can be found in the Tools → Head & Footer Code section.
    6. In the target section, paste the desired code.

    Frequently Asked Questions

    Is PHP code supported in code snippets?

    Because entering PHP code into any plugin field (global or article specific) poses a security risk, the Head & Footer Code does not process it.

    Any content entered into HFC fields is printed in its entirety on the front end.

    I put code in the BODY section, but nothing appears on the front end.

    Since WordPress version 5.2, this feature has been available and requires theme compatibility.

    To see if your theme supports the wp_body_open hook, open the header.php file from your theme in a code editor and look for the following code right after the <BODY> tag (if it doesn’t exist, add it or hire a developer to do it for you):

    wp_body_open(); wp_body_close(); wp_body_close(); wp_body_close(); if ( ‘wp_body_open’ ) function_exists

    Observations

    Exactly what I’m looking for

    A must-have extension

    Exceptional Plugin

    Excellent plugin and customer service.

    Thank you very much!

    Irresistible

    Developers & Contributors

    This plugin was made possible by the contributions of the people listed below. The software “Head & Footer Code” is free and open source.

      The translators are to be thanked for their efforts. The phrase “Head & Footer Code” has been translated into five different languages.

      “Head & Footer Code” should be translated into your native tongue.

      Do you want to learn more about development?

      Check out the code, the SVN repository, or the RSS feed for the development log.

      a list of changes

      1.2.3 (July 19, 2021)

      • WordPress 5.8-RC4 and PHP 8.0.8 were used to test this.
      • Inc/front.php: Trying to get property ‘post_type’ of non-object (thanks to @tekgirlymama) (202) 205-04-04 Errors must be corrected.
      • Improve: DRY for determining the type of post.

      1.2.2 (as of April 24, 2021)

      • WordPress 5.7.1 was used to test this.
      • (202) 2021-02-01 Thanks to @swinggraphics, we were able to fix the acoustic errors in the update script.
      • Improve the wording on the listing of posts and pages.

      1.1.10

      • To show if/what article specific custom code is defined, add a Head & Footer Code column to the post/page/custom post type listing.
      • Fix: in_array() expects parameter 2 to be array, but null is given on lines 46, 111, and 176 of head-footer-code/inc/front.php.

      1,2

      • In Blog Posts mode, add custom head, body, and footer code to the Homepage.
      • Fix: In WordPress 5.5, the Code Editor was broken.
      • https://github.com/urosevic/head-footer-code/issues/1 Fix: Invalid requests while saving settings
      • DRY for front-end conditions should be improved.
      • Improve: hints from translators for long strings.
      • Improve: all strings are localizable.

      1.1.1 is an abbreviation for

      • WordPress 5.4.1, 5.5-RC2-48768, and PHP 7.4.1 were used to test this.
      • Video tutorial on how to install, configure, and use the Head & Footer Code plugin has been added.

      Version 1.1.0

      • WordPress 5.1.4, 5.3.2, and 5.4-beta3 were tested with PHP 7.2.15 and 7.3.7.
      • Backslashes are removed on post/page updates in article-specific HEAD/BODY/FOOTER code, as reported by @asherber (update_post_meta passes key and value to update_metadata, which expects them to be slashed key and value).
      • WordPress 5.2 introduced the body hook. Support for wp_body_open has been added.
      • Add wp_body_open backward compatibility for older WordPress installations.
      • Add FAQ instructions on how to add wp_body_open support to any theme.
      • Links and wording on the plugin settings page have been updated.
      • Screenshots have been updated.

      Version 1.0.9.1

      • Fix: Multisite WP’s Fatal Error (thanks to @kunzemarketing for reporting)
      • DRI for front-end debugging should be improved.

      1.0.10

      • Add: Descriptive post types and descriptions for specific sections within articles.
      • Add: Option to process shortcodes in the FOOTER section (global and article-specific settings)
      • Change: HEAD and FOOT priority should be separated so that the admin can set different priorities for the header and footer.
      • In the plugin settings, enable the CodeMirror code editor for HEAD and FOOTER code.
      • Add: Plugin activation hook to avoid fatal errors in legacy WP and/or PHP installations.
      • Enhance: Loading safety

      0.8.1

      • Test WordPress 5.1.1 and PHP 7.2.15 compatibility.
      • Changes to the layout of the meta boxes and the type of behavior selector
      • Change: Make all post metaboxes OOP.
      • GNU GPL v3 license change
      • Bundle the GNU GPLv3 license with the plugin codebase.
      • Screenshots have been updated.

      1.1.7%

      • WordPress 4.7.1 was used in the testing. Check for compatibility:
      • UX: On the global settings page, add a right-hand sidebar with links to donate, FAQ, Community support, and the plugin Reviews page.
      • Set monospaced font for textareas in global settings and article pages for a better user experience.

      1.1.66

      • On line 41 of wp-contentpluginshead-footer-codeincfront.php, an attempt was made to get a property of a non-object. PHP has been fixed.
      • Fix: If the post/page template has another WP Loop query after the content (like the recent posts WP Widget in the RHS sidebar), the footer content will be overwritten.
      • Avoid reading post meta if the post isn’t singular or if the post type isn’t enabled.
      • On WordPress v4.5-alpha-36504 and theme Twenty Sixteen v1.2-alpha in a Multisite environment (main and other network websites).

      1.1.5%

      • Enhancement: Add an uninstall routine to clean up after plugin removal.
      • Enhancement: Debug comments should include the post type.
      • Readme: Updated compatibility and tested on WordPress v4.4-beta1.

      1.1.44

      • Fix: in_array() expects parameter 2 to be an array, but it’s a string (introduced in v1.0.3).

      1.3.0

      • Change: For page specific head/footer code, make even default WP post types post and page optional.

      Version 1.0.2

      • Change: If the plugin is used on a website that violates PayPal’s Acceptable Use Policy, PayPal donation links will be replaced to prevent account limitations.

      Version 1.0.1

      • PHP Error Fix Trying to get a non-object’s property
      • Optimize: Remove attachment post type from the list of options because there’s no reason for attachments to have custom head/footer code.
      • Optimize: Code cleanup settings

      Version 1.0.0

      • This is the first release.

      Meta-analysis

      • Chinese (China), English (United States), French (France), Serbian, Spanish (Spain), and Spanish (Venezuela) are the languages spoken in the world.

      • scriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscriptsscript
      • Scores

          Participants

            Encouragement

            In the last two months, the following issues have been resolved:

            Make a donation

            Would you like to contribute to the plugin’s development?

Leave a Comment