TAILIEUCHUNG - Hướng dẫn tạo themes cho wordpress part 22

File này chứa tất cả các mã cần thiết cho các trang tùy chọn chủ đề. Điều tiếp theo mà bạn cần làm là để treo trang admin vào menu WordPress hành chính. Mở hoặc tạo tập tin chủ đề của bạn và chèn mã sau đây: | Chapter 11 table class form-table tbody tr th scope row label for custom-theme-header-color php _e Header Color label th td input type text class regular-text name custom-theme-header-color id custom-theme-header-color value php echo esc_attr settings header-color td tr tbody table p class submit php wp_nonce_field custom-theme-save-options input type submit class button-primary name custom-theme-save-options id custom-theme-save-options value php _e Save p form div This file contains all of the code necessary for the theme options page. The next thing that you need to do is to hook the admin page into the WordPress administrative menu. Open or create your theme s file and insert the following code if class_exists My_Theme class My_Theme var settings null function My_Theme add_action admin_init array this save_settings add_action admin_menu array this add_admin_stuff function add_admin_stuff add_theme_page _ My Theme __ My Theme switch_themes my-theme array this display_theme_admin_page function display_theme_admin_page include TEMPLATEPATH. admin 215 215 Advanced WordPress Themes-------------------------------------------------- function save_settings if isset _POST custom-theme-save-options check_admin_referer custom-theme-save-options current_user_ can switch_themes settings this- get_settings settings header-color stripslashes _ POST custom-theme-header-color this- set_settings settings wp_redirect admin_url page my-theme updated 1 function get_settings if null this- settings this- settings get_option My Theme Custom Settings array return this- settings function set_settings settings if settings is_array settings this- settings settings update_option My Theme Custom Settings this- new My_Theme my_theme function get_custom_theme_header_color global my_theme settings my_theme- get_settings color settings header-color if empty color color 000000 return color function the_custom_theme_header_color echo .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.