-->

Post Top Ad

Tuesday, August 22, 2017

Tổng hợp code giúp tùy biến footer trong Genesis Framework

Tổng hợp code giúp tùy biến footer trong Genesis Framework và Genesis child theme


Theo mặc định, phần footer (chân trang) của Genesis Framework hay Genesis child theme chỉ bao gồm textlink của framework (hoặc child theme), của WordPress và một liên kết đến trang đăng nhập. Nếu muốn tùy biến footer, cách đơn giản nhất là sử dụng plugin Genesis Simple Edits. Tuy nhiên, nếu bị “dị ứng” với plugin và không muốn cài đặt chúng vì sợ nặng site thì bạn hoàn toàn có thể sử dụng các code snippets sau đây để tùy biến phần footer theo ý muốn.
Tham khảo thêm:

Tùy biến footer trong Genesis

Riêng với theme Paradise, chúng tôi đã tích hợp tính năng cho phép chỉnh sửa footer trong Genesis => Theme Settings => Custom Footer Credits. Các bạn không cần phải sử dụng code bên dưới nữa.
1. Đầu tiên, truy cập thư mục cài đặt WordPress thông qua File Manager của cPanelDirectAdmin hoặc phần mềm FTP, tìm theo đường dẫn /wpcontent/themes/. Tìm và mở file functions.php của Genesis Framework hoặc child theme mà bạn đang sử dụng ra.
2. Thêm một trong những đoạn code sau đây vào cuối file functions.php và lưu lại.

Đặt lại vị trí footer

Tùy biến nút return to top

//* Tùy biến nút Return to Top trong Genesis
add_filter( 'genesis_footer_backtotop_text', 'sp_footer_backtotop_text' );
function sp_footer_backtotop_text($backtotop) {
$backtotop = '[footer_backtotop text="Return to Top"]';
return $backtotop;
}

Tùy biến credits text hoặc footer text

Bạn có thể sử dụng 1 trong 2 code snippets sau:
//* Tùy biến Credits text trong Genesis 1
add_filter( 'genesis_footer_creds_text', 'sp_footer_creds_text' );
function sp_footer_creds_text() {
echo '<div class="creds"><p>';
echo 'Copyright &copy; ';
echo date('Y');
echo ' &middot; <a href="http://mydomain.com">My Custom Link</a> &middot; Built on the <a href="http://www.studiopress.com/themes/genesis" title="Genesis Framework">Genesis Framework</a>';
echo '</p></div>';
}
view rawtuy-bien-footer-text hosted with ❤ by GitHub

Tùy biến toàn bộ nội dung trong footer

Xong. Đơn giản vậy thôi. Chúc các bạn thành công!

No comments:

Post a Comment