Professional WordPress. Design and Development, 3rd Edition

Professional WordPress. Design and Development, 3rd EditionReviews
Author: Brad Williams, David Damstra, Hal Stern
Pub Date: 2014
ISBN: 978-1-4920-0783-8
Pages: 504
Language: English
Format: PDF
Size: 21 Mb


Master WordPress development with this top-ratedguide
Professional WordPress Design and Development has been afavorite resource of developers since the first edition in 2010.Now fully updated for the current WordPress release, this3rd edition offers new coverage of migrating websites toWordPress, the latest tools, and cutting edge uses for WordPress.You’ll gain insight into real projects that currently useWordPress as an application framework, as well as the basic usageand functionality of the system from a developer’sperspective. Detailed information and real-world examples will helpyou use the world’s largest self-hosted website platformefficiently, effectively, and professionally.
Professional WordPress Design and Development
– Clearly explains and demonstrates timeless WordPressfundamentals, no matter what version
– Gets you quickly up to speed on the new tools and features ofWordPress
– Explores new uses for WordPress, illustrated with real-worldprojects
– Demonstrates how to efficiently migrate existing websites toWordPress
– Presents new ideas and expert perspectives on full systemexploitation
– Offers techniques for crafting the best user experience,securing WordPress, managing data, and determining when WordPressis the right tool
– Provides everything you need to understand, develop, and deploysuccessful WordPress sites


You’ll use the admin_init hook for your custom function for saving the form data. The first step is to verify that form values have been posted. If the form wasn’t submitted, there’s nothing for you to process. You’ll do this by verifying that $_POST[‘network_settings’] is actually set by using the isset() PHP function. Once you’ve verified that there is form data to process, you need to check your nonce using the check_admin_referer()function.

Once the nonce check passes, you’ll store the post data in the $network_settings variable. Because the data that you are processing is user‐provided, it’s important to sanitize that data before storing it in the database. In this example, you’ll use the array_map() PHP function,which will send each individual value of the array to any function specified, in this case the sanitize_text_field() WordPress function. Now that your data is properly sanitized, you’ll save the option using the update_site_option()function.

That’s it! You have just built a fully functionalnetworksettings section that is fully compatible with standardWordPress. Ifthe user is running Multisite, the menu willshow in the NetworkAdmin andthe option values will be storedin the wp_sitemeta table. Ifthe user is not running Multisite, the menu willshow in the standardWordPress Admin Dashboardandthe option values will be storedin the wp_options table.
Listing10‐3 shows the finalized plugin.


Super Admins

Earlier in this chapter, we coveredthe new user role introducedin Multisite, the Super Admin role. Any user set to the Super Admin role has fullcontrolover every site in your Multisite network. Users set to the Super Admin role also have fullcontrolover what themes andplugins are available, allusers, andnetwork‐wide settings.

To retrieve a list ofallSuper Admins in Multisite you’lluse the get_super_admins() function. This function accepts no parameters and returns an array of all Super Admin usernames in your network. Here’s an example:

Network Stats

Multisite features various functions to generate stats about your network. The get_blog_count()function returns the total number of sites in your network. To return the total number of users inyour network, use the get_user_count()function: