Skip to content

Instantly share code, notes, and snippets.

@lunaluna
Created April 3, 2020 10:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lunaluna/5a25cd22714370c0d067d4e39ba90627 to your computer and use it in GitHub Desktop.
Save lunaluna/5a25cd22714370c0d067d4e39ba90627 to your computer and use it in GitHub Desktop.
body開始タグ直後にソースコードを挿入
<?php
/*********************************/
/*
/* bodyタグ開始直後にコードを挿入
/*
/*********************************/
add_action( 'wp_body_open', function() {
?>
<?php // 挿入したいコードの例 ?>
<noscript>
...
</noscript>
<?php
});
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<?php
if ( function_exists( 'wp_body_open' ) ) {
wp_body_open();
}
?>
<?php wp_footer(); ?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment