Escolar Documentos
Profissional Documentos
Cultura Documentos
Notice the spacing technique for each statement. This makes reading and following your code logic
much easier because the code examples are clean and consistent throughout.
Shorthand PHP
You shouldnt use the shorthand PHP tags ( <? ?> ) in your code. The reason for this is that
shorthand PHP tags must be enabled on your server before they will function. Many hosting
configurations have this feature disabled by default, which means your plugin would immediately
break when activated in WordPress. Instead, you should wrap your PHP code in standard tags:
<?php ?>
SQL Statements
When making database calls in WordPress you may need to write custom SQL statements to query
the proper data from the database. SQL statements can be broke into multiple lines if the complexity
of the statement warrants it. Even though SQL is not case-sensitive, its good practice to capitalize
the SQL commands in the statement.
SELECT username FROM table1 WHERE status = active
Chapter 6, Plugin Security, discusses the proper way to use SQL statements in WordPress.
Have you verified the plugin doesnt exist in the Plugin Directory?
www.it-ebooks.info
Summary
Verify both Plugin URI and Author URI values are set.
27
Create an uninstall.php fi le
File references.
Use the proper directory constants and functions to determine paths within
WordPress and your plugin.
SUMMARY
This chapter discussed creating a proper foundation when developing plugins for WordPress.
Following these techniques is essential in creating plugins that work across all types of WordPress
setups. Keeping your code properly documented is also an important step in detailing how your
code functions and why. This can save time in the future when revisiting your code for updates. It
can also help other developers understand your code logic.
www.it-ebooks.info