wp_head, wp_footer 훅을 이용해서 스타일이나 스크립트 코드를 추가하는 방법
/**
* Add scripts to wp_footer()
*/
function child_theme_footer_script() {
if(is_page( array( 'somepage' ) ) ) { ?>
<script type="text/javascript">
(function($) {
// console.log('link-ok');
})( jQuery );
</script>
<?php
}
}
add_action( 'wp_footer', 'child_theme_footer_script', 99 );
/**
* Add scripts to wp_head()
*/
add_action( 'wp_head', function () { ?>
<script type="text/javascript">
(function($) {
// console.log('link-ok');
})( jQuery );
</script>
<?php
});