generatepress 테마를 사용하고 있는데 하단 카피라이터를 수정하는 방법 1가지 이야기 하려 합니다. 유료 버전을 사용하면 일도 아니지만 기본테마를 사용하고 있다면 child theme를 만들어서 사용하는 것을 추천합니다.
아래 코드는 제가 실제로 사용하고 있는 파일 입니다.
themes/generatepress-child/functions.php
<?php
function my_theme_enqueue_styles() {
// 부모 테마의 스타일을 불러오기
wp_enqueue_style('parent-style', get_template_directory_uri() . '/style.css');
// 자식 테마의 스타일을 불러오기
wp_enqueue_style('child-style', get_stylesheet_directory_uri() . '/style.css', array('parent-style'));
}
add_action('wp_enqueue_scripts', 'my_theme_enqueue_styles');
// 새로운 함수: 사용자 정의 JavaScript 추가
function enqueue_custom_scripts() {
wp_enqueue_script('custom-js', get_stylesheet_directory_uri() . '/js/custom.js', array(), '1.0', true);
}
add_action('wp_enqueue_scripts', 'enqueue_custom_scripts');
add_filter( 'generate_copyright','my_custom_copyright' );
function my_custom_copyright() {
?>
Copyright © <?php echo date("Y"); ?>. <a href="https://url.kr/generatepress" target="_blank">Built with GeneratePress</a>
<?php
}
?>
하단 카피라이터 수정 방법
위 내용 중 아래 부분이 하단 카피라이터를 담당하는 부분입니다.
add_filter( 'generate_copyright','my_custom_copyright' );
function my_custom_copyright() {
?>
Copyright © <?php echo date("Y"); ?>. <a href="https://url.kr/generatepress" target="_blank">Built with GeneratePress</a>
<?php
}
하단 카피라이터 삭제
만약 하단 카피라이터 부분을 아예 삭제하고 싶다면 아래 코드를 사용하면 됩니다.
add_action( 'after_setup_theme', 'tu_remove_footer_area' );
function tu_remove_footer_area() {
remove_action( 'generate_footer','generate_construct_footer' );
}