functions.php에 추가
1. <head>
에 메타태그 삽입
function custom_meta_tags() {
?>
<meta name="author" content="홍길동">
<meta name="description" content="포트폴리오입니다.">
<?php
}
add_action('wp_head', 'custom_meta_tags');
2. <body>
바로 아래 삽입 (예: Google Tag Manager, 초기 로딩 스크립트 등)
function custom_after_body_open() {
?>
<!-- Body 시작 후 삽입될 내용 -->
<div id="loading-screen" style="display: none;">로딩 중...</div>
<?php
}
add_action('wp_body_open', 'custom_after_body_open');
3. <footer>
또는 </body>
바로 위 삽입 (예: JS, 추적 코드 등)
방법: wp_footer
훅 사용
function custom_footer_content() {
?>
<!-- Footer 앞 삽입될 내용 -->
<script>
console.log("진철 footer script");
</script>
<?php
}
add_action('wp_footer', 'custom_footer_content');