Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
WordPress 3 Plugin Development Essentials

You're reading from   WordPress 3 Plugin Development Essentials Create your own powerful, interactive plugins to extend and add features to your WordPress site

Arrow left icon
Product type Paperback
Published in Mar 2011
Publisher Packt
ISBN-13 9781849513524
Length 300 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Toc

Table of Contents (19) Chapters Close

WordPress 3 Plugin Development Essentials
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
1. Preparing for WordPress Development FREE CHAPTER 2. Anatomy of a Plugin 3. Social Bookmarking 4. Ajax Search 5. Content Rotator 6. Standardized Custom Content 7. Custom Post Types 8. Versioning Your Code with Subversion (SVN) 9. Preparing Your Plugin for Distribution 10. Publishing Your Plugin Recommended Resources WordPress API Reference Index

PHP functions


There are over 700 functions built into PHP. The following are seven that we used, with examples.

dirname

string dirname( string $path); 

Returns parent directory's path. Often this is used to determine the path to the current script.

Example:

print dirname(__FILE__); // prints something like '/users/me'

file_get_contents

string file_get_contents( string $filename [, bool $use_include_path = false [, resource $context [, int $offset = -1 [, int $maxlen ]]]] )

Reads an entire file into a string. This is a useful way to read static, non-PHP files. It can even work for downloading remote files, but it's better to tie into the curl functions for serious downloading.

preg_match

int preg_match( string $pattern , string $subject [, array &$matches [, int $flags = 0 [, int $offset = 0 ]]] )

The preceding code performs a regular expression match using Perl-compatible regular expressions.

Example:

if ( preg_match('/^wp_/', $post_type) ){
   print 'Post type cannot begin with wp_';
}

Note

Special...

lock icon The rest of the chapter is locked
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
WordPress 3 Plugin Development Essentials
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Modal Close icon
Modal Close icon