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

Cuối cùng, bạn bao gồm thành phần này vào file của bạn để nó hiển thị trên mỗi trang của trang web. Một khi nó đã được bao gồm một cách thích hợp, bạn theo kiểu nó bằng cách sử dụng một số tìm kiếm màu sắc tốt và bố trí. | Chapter 12 add_action parse_request wptc_save_user_cat_order function wptc_save_user_cat_order wp if isset _POST save-user-cat-order args wp_parse_args stripslashes _POST user-cat-order cats array args user_cat setcookie user-cat- order maybe_serialize cats time 3600 24 31 exit global user_cat_order user_cat_order unserialize stripslashes _COOKIE user-cat-order user_cat_order is_array user_cat_order user_cat_order false function wptc_sort_categories categories global user_cat_order current_categories if user_cat_order current_categories array foreach categories as category current_categories category- term_id user_cat_order current_categories usort categories wptc_order_category_overview return categories function wptc_order_category_overview catA catB global user_cat_order current_categories if user_cat_order posA array_search catA- term_id user_cat_order if false posA posA -1 posB array_search catB- term_id user_cat_order if false posB posB -1 return posA - posB else return -1 Layout This code intercepts the save request that you ll make use of when a user finishes sorting the categories. Also you ve added a custom sorting function that makes sure that the categories are in the correct order before rendering them to the browser. Next open up your JavaScript file and change your code to the following. This code adds an event handler that fires when your user finishes sorting the categories on the front-end. The handler fires off a request when the user finishes sorting. The request contains the necessary variables to save the categories being sorted. Particular areas of interest have been marked in bold jQuery document .ready function content .sortable stop wptc_user_cat_order items handle h2 placeholder piece ui-sortable-placeholder function wptc_user_cat_order event ui I I save-user-cat-order 1 user-cat-order this .sortable serializel To test this functionality refresh the category overview page that you ve been working on. You .

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.