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

Khi trang mẫu này được sử dụng, tiêu đề của cuốn sách sẽ được hiển thị như các chính nhóm này và sẽ được theo sau bởi một danh sách đặt hàng các đề mục chương và trích đoạn. Nếu bạn đã thêm vào nội dung của bạn một cách chính xác, và lựa chọn các mẫu trang Mục lục cho các trang sách chính của bạn, bạn sẽ thấy một cái gì đó tương tự như ví dụ hiển thị trong hình sau đây:. | Chapter 7 ol php div div php get_sidebar php get_footer When this page template is used the book s title will be displayed as the main heading and will be followed by an ordered list of chapter titles and excerpts. If you ve added your content correctly and selected the Table of Contents page template for your main book page you should be seeing something similar to the example shown in the following screenshot Custom Page Templates You ll see here that you have your book title at the very top of the page followed by the full content of your book s description. After that you have a link to each chapter along with the chapter title and an excerpt. How it works. By this point you should have a pretty good idea of the way that custom page templates work. If you need a refresher see the How it works. section of the Creating a simple page template recipe. In addition you ll notice that we ve used a custom Loop in this page template. For more on custom and multiple Loop constructs see the recipe Creating multiple loops on a single page in Chapter 3 The Loop. There aren t too many new and novel things in this recipe but there is one particular item to note. Check out the get_the_iD function usage in the recipe code. Rather than hard-coding a parent ID to fetch the book s chapters you re dynamically applying the ID from the currently-viewed page. This means that you can reuse the Table of Contents page template for multiple books on a single site. There s more. You ve created a page template that links to each of the chapters in a book and this should prove quite useful to your site s visitors. However wouldn t it be great if your chapters showed your visitor s progress through the book that they re reading It s easy with another custom page template. Create a new file called insert and then save the following code and then assign to each chapter the Chapter page template php get_header div id container div id content php global post if .

Đã 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.