Tài liệu wp ajax book doc

298 244 0
Tài liệu wp ajax book doc

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

[...]... 11 WordPress and Admin Ajax ������������������������������165 WordPress' admin -ajax. php 166 Registering the Ajax Processor 168 Getting the Location of the Ajax Processor 170 Passing Data to the Ajax Processor 171 The wp_ ajax Callback Method 173 Finalizing the Ajax Processor 173 Admin Ajax Conclusion 175 Chapter 12 Example 1: WP Grins Lite������������������������������177 The WPGrins Class 181 The Constructor... WordPress and Ajax 19 Introduction Online Resources To access the code and various resources mentioned in this book, please visit: • http://www.wpajax.com/code/ - Downloadable code samples • http://www.wpajax.com/links/ - Links and resources mentioned in this book A Word of Warning Ok, perhaps I should have said “words.” My writing style throughout this book is very casual I wrote this book as if we’re... achieve Ajax nirvana So what are you waiting for? Let’s begin 20 WordPress and Ajax Chapter 1 What is Ajax? 22 What is Ajax? First things first What the heck is Ajax anyways besides a lovely acronym (Asynchronous JavaScript and XML)? It’s definitely not a common household cleaner (at least, not on the Internet) Let’s just say that Ajax consists of a bunch of tubes Okay, bad joke, but let’s go on Ajax, ... Response Output Results Figure 1 Ajax Process Now implementing Ajax, and implementing it well, is another story So let’s read on 24 WordPress and Ajax Ajax Best Practices As with any technology, Ajax can easily be abused I’ve seen too many sites that depend on Ajax for navigation or to access crucial and/or critical content without alternatives From my perspective, Ajax should be absolutely transparent... your script (using wp_ register_script), you can call your script by calling: wp_ enqueue_script('my_script'); Src The src argument is asking for the URL of the file If you supply the src of the script, the 30 WordPress and Ajax function automatically registers your script for others to use (no need to use wp_ register_script) wp_ enqueue_script An example of wp_ enqueue_script in use is: wp_ enqueue_script('my_script',... Automattic and the contributors behind WordPress Introduction 16 How About a Little Ajax? I’m rather biased when it comes to Ajax One of my first WordPress plugins is Ajax- based As soon as I started using Ajax, I fell in love with the possibilities You see, Ajax is what helps achieve that “rich” Internet experience Ajax helps eliminate unnecessary page loads, can streamline a user interface, and can... years WordPress and Ajax 17 Introduction This book began humbly I thought to myself, “Why not write a quick group of articles on using Ajax with WordPress?” I began working on an outline, and it became quite obvious this wasn’t going to be a short series of articles In order to adequately cover the topic, there needed to be much, much more The Goal of the Book The goal of this book is to provide you... you a rocksolid foundation for using Ajax with WordPress After the foundation has been laid, you will be walked through several real-world examples By the end of the book, you should not only have a thorough understanding of Ajax, but how Ajax functions within WordPress itself The code examples I present are from my own (sometimes painful) experiences with using Ajax I’ve cried I’ve bled And I hope... even know he’s using Ajax Ajax should be used to accomplish quick and simple tasks That’s it Anything more is just asking All we should know from the end-user’s perspective is that it works Chapter 1, What is Ajax? Ajax should be absolutely and completely transparent to the user 25 to be beat down by the Internet troll (and he’s mean) Here are some good examples of when to use Ajax: • Reduce the need... can make a task that is cumbersome run gracefully behind the scenes As with every piece of technology, Ajax can be used for good or for bad There are those that will use and abuse Ajax (and they should be spanked unmercilessly) The Book s Beginning When I was learning Ajax with WordPress, finding good documentation was hard to find My education was basically ripping code from other plugins, mashing them . Processor 171 e wp_ ajax Callback Method 173 Finalizing the Ajax Processor 173 Admin Ajax Conclusion 175 Chapter 12 Example 1: WP Grins Lite 177 e WPGrins Class. Admin Ajax 165 WordPress' admin -ajax. php 166 Registering the Ajax Processor 168 Getting the Location of the Ajax Processor 170 Passing Data to the Ajax

Ngày đăng: 22/02/2014, 07:20

Mục lục

  • Acknowledgments

    • About Ronald Huereca - Author

      • Credits and Thanks

      • Introduction

        • How About a Little Ajax?

        • The Book’s Beginning

        • The Goal of the Book

        • Helpful Tools for the Journey

        • A Word of Warning

        • Chapter 1

          • What is Ajax?

          • Chapter 2

            • Adding Scripts Properly to WordPress

              • So How Does wp_enqueue_script Work?

                • Handle

                • Chapter 3

                  • Localizing Your Scripts

                    • wp_localize_script

                      • Handle

                      • wp_localize_script Example

                      • Chapter 4

                        • Adding Styles Properly to WordPress

                          • How Does wp_enqueue_style Work?

                            • Handle, Src, Deps, and Ver

                            • The wp_enqueue_style Hooks

                              • The init Technique

                              • Chapter 5

                                • Page Detection in WordPress

                                  • WordPress Conditionals

                                    • Loading Scripts on the Front-End

                                    • Loading Scripts on the Home Page

                                    • Loading Scripts on the Front Page

                                    • Loading Scripts on Posts or Pages

                                    • Loading Scripts on Comment Pages

                                    • Loading Scripts for Post Types

                                    • Loading Scripts for Custom Taxonomies

                                    • Loading Scripts for Detecting Shortcodes

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan