background preloader

Function Reference

Function Reference
Languages: English • Español • فارسی • Français • Italiano • 日本語 ქართული • 한국어 • Português do Brasil • Русский • Türkçe • עברית • 中文(简体) • 中文(繁體) • (Add your language) The files of WordPress define many useful PHP functions. Some of the functions, known as Template Tags, are defined especially for use in WordPress Themes. Many of the core WordPress functions are useful to Plugin and Theme developers. You can help make this page more complete! Here are some things you can do to help: Add documentation to un-documented functions, by creating sub-pages or at least by adding short comments in the lists below. Read Contributing to WordPress to find out more about how you can contribute to the effort! Functions by category Official and Unofficial References Trac Browser - WordPress source code.

Developer Documentation Developer Documentation Languages: English • Español • Italiano • 한국어 • Русский • 中文(繁體) • (Add your language) Introduction WordPress is fast, lightweight, and easy to use. You may also wish to consult the Developer Documentation FAQ. WARNING: Programming Code Ahead The following articles may use programming terms without offering detailed explanations for non-programmers. Although the alteration of the downloadable files for WordPress is limited to a few distinct programmers, every WordPress user has the ability to effect change in the core WordPress code, making WordPress highly customizable. Plugin Development Writing a Plugin - The best starting place for learning about how to develop plugins WordPress Coding Standards - General information about coding standards for WordPress development Debugging in WordPress - Reference and guide for using the built-in debugging system in WordPress. APIs Contributing to WordPress Forums, Lists, and Blogs Other Information of Interest External Resources

Using the WordPress Uploader in Your Plugin or Theme WordPress has a nice media uploader dialog that it uses on the editor pages. Now wouldn’t it be nice if you could use it to handle image uploads for part of a plugin or theme you’re writing? Maybe you want to add an easy way to change the logo in a theme? A simple “Upload Image” button would work quite well for that, wouldn’t it? It’s fairly simple to implement, providing you already have a bit of experience with the WordPress API. The first step is to prepare your HTML. <tr valign="top"><th scope="row">Upload Image</th><td><label for="upload_image"><input id="upload_image" type="text" size="36" name="upload_image" value="" /><input id="upload_image_button" type="button" value="Upload Image" /><br />Enter an URL or upload an image for the banner. Now that the easy part is out of the way, it’s time to start making it do something. function my_admin_scripts() { wp_enqueue_script('media-upload'); wp_enqueue_script('thickbox'); wp_register_script('my-upload', WP_PLUGIN_URL.' That’s it.

Theme Development Languages: বাংলা • English • Español • 日本語 한국어 • Português do Brasil • Русский • 中文(简体) • 中文(繁體) • (Add your language) This article is about developing WordPress Themes. If you wish to learn more about how to install and use Themes, review Using Themes. Why WordPress Themes WordPress Themes are files that work together to create the design and functionality of a WordPress site. You may wish to develop WordPress Themes for your own use, for a client project or to submit to the WordPress Theme Directory. To create a unique look for your WordPress site. A WordPress Theme has many benefits, too. It separates the presentation styles and template files from the system files so the site will upgrade without drastic changes to the visual presentation of the site. Why should you build your own WordPress Theme? It's an opportunity to learn more about CSS, HTML, and PHP. Theme Development Standards WordPress Themes should be coded using the following standards: Anatomy of a Theme Child Themes style.css

Database Description Languages: English • العربية • 日本語 中文(简体) • 한국어 • Русский • (Add your language) The following is an outline and description of the database tables created during the standard installation of WordPress. The database structure and the diagram below were last updated in version 4.4. The only database supported by WordPress is MySQL version 5.0.15 or greater, or any version of MariaDB. Also see prior versions of Database Descriptions for WordPress 1.5, WordPress 2.0, WordPress 2.2, WordPress 2.3, WordPress 2.5, WordPress 2.7, WordPress 2.8, WordPress 2.9, and WordPress 3.3. Because WordPress interfaces with this database by itself, you as an end user, shouldn't have to worry much about its structure. Database Diagram The diagram below provides a visual overview of the WordPress database and the relations between the tables created during the WordPress standard installation. (WP 4.4.2 Database diagram) Table Overview Table Details Indexes Table: wp_links Table: wp_options Table: wp_posts Table: wp_site

WordPress hooks database - action and filter hooks for wp plugin developers -- Adam Brown, BYU Political Science What is a hook? In brief, WordPress hooks enable you to change how WordPress behaves without editing any core files. Because you leave the WordPress files untouched, you can painlessly upgrade your blog with each new version of WordPress. It's this hooks architecture that makes WordPress the best blogging solution. If you don't know what WordPress hooks are for, read the Plugin API or this tutorial. What is this directory? If you're a plugin or theme developer, you know how difficult it can be to figure out which hooks are available. What is this good for? See what new hooks are available with each new version of WordPress See which hooks have been deprecated or renamed (use the "view all hooks" option) Easily learn exactly which WP file(s) use each hook. How to help? Update and improve the official action and filter references.

Everything about WordPress Configuration (wp-config.php) - Complete WordPress Backup Service Editing configuration files is often considered a daunting task by all of us. We always try our best to avoid modifying the default settings. What if something goes wrong? WordPress installation brings with it about a 1000 files amongst which is the trickiest one – wp-config.php, the WordPress configuration file. Of course, this file can remain untouched if you want to stick to the default settings but it becomes a necessary evil to edit this file to apply security precautions, customize functionality and improve performance. When you install WordPress, the wp-config.php isn’t included. The configuration is most vulnerable to attacks making it imperative for you to secure it in the best possible way. Another important security measure is the file permission. The third step involves modifying the .htaccess file and not the wp-config.php file. # protect wpconfig.php order allow,deny deny from all Database Configuration e.g. define(‘DB_HOST’, ‘localhost:1234′); Security Keys Table Prefix

Roles and Capabilities Roles and Capabilities Languages: English • Español • Français • 日本語 • Português do Brasil • 中文(简体) • (Add your language) Description WordPress uses a concept of Roles, designed to give the site owner the ability to control what users can and cannot do within the site. WordPress has six pre-defined roles: Super Admin, Administrator, Editor, Author, Contributor and Subscriber. The Super Admin role allows a user to perform all possible capabilities. Summary of Roles Super Admin – somebody with access to the site network administration features and all other features. Upon installing WordPress, an Administrator account is automatically created. The default role for new users can be set in Administration Panels > Settings > General. Roles A Role defines a set of tasks a user assigned the role is allowed to perform. The following sections list the default Roles and their capabilities: Super Admin Multisite Super Admins have, by default, all capabilities. Administrator Additional Admin Capabilities

Admin Notices in WordPress Occasionally a plugin or theme will need to display a notice to users in the WordPress dashboard. This is fairly easy to do using the admin_notices hook, which shows a standard message box at the top of the screen. Example Admin Notices Display a Standard Notice Since this div is classed “updated” the notice will display yellow. How To Make a Dismissible Notice With a little more work it’s also possible to display a notice stays present until the user clicks to ignore it. The following example was adapted from the AddThis plugin. If a user clicks to hide the notice, it will save their preference in the user meta. Display Notices Only On Certain Admin Pages If possible, target the notice to only appear on certain pages where the user needs to see them. For example, this notice will only appear on the plugins page: Check User Role Before Displaying a Notice Notices should only be displayed to users that can actually do something about them. Here’s some common roles checks you might want to do:

20 Time-Saving WordPress SQL Query Snippets WordPress stores every single scrap of information within a MySQL database. Posts, pages, comments, shortcodes, plugin settings… absolutely everything. The WordPress backend is fantastic, and does allow you to manage and edit everything with ease, but only up to a certain point. Say you have hundreds or even thousands of posts within your database, and you need to make site-wide global changes. Making each edit, via the WordPress Dashboard, can be time-consuming and does open up the possibility of mistakes occurring. Always Backup WordPress First! Your WordPress database stores every single one of your carefully written posts, every comment from your loyal readers and every setting that you have used to personalize your site. Here are some resources to help you backup WordPress: You might also like these useful .htaccess snippets & hacks or these snippets that make WordPress user-friendly for your clients. Useful WordPress SQL Queries Add a Custom Field to All Posts & Pages Source Source

Ultimate Guide to Roles and Capabilities | Gary Cao Since Roles and Capabilities are introduced in WordPress 2.0, the User Level approach has been declared deprecated. However, it’s disappointing that a lot of plugins and themes out there still use user levels to control access to admin option pages and other functionalities. This guide shows you how to properly use Roles and Capabilities in your plugins and themes. Note: This article is a long one, therefore you should probably bookmark it so that you can always come back later for reference. Table of Contents What are Roles and Capabilities? As in other CMS and web applications, WordPress has a built-in system to verify whether a particular user has enough privilege to take a certain action. This system of Roles and Capabilities is much more flexible than User Level, since it enables you to add, remove or reassign capabilities among roles. Capabilities and administration menus As you can see, there’s always a required parameter called capability for each of those functions. WP_Role Class

How to Put Amazon Affiliate Links on Your WordPress.com Blog | さまざまの言葉… random items Amazon associates have had some gripes with the free WordPress.com (WP) site. WP places some technical restrictions on blog features in order to prevent nasty people turning WP into an anti-security weapons platform, and toprevent the avaricious from turning WP into the scam capitol of the world. This, unfortunately breaks some of the shiny tools that Amazon provides to their associates. This is neither good nor bad, it’s just an unfortunate collision between two companies with mismatched goals. Here are my personal notes for adding an Amazon associate link to a WordPress.com blog. The Familiar Part The following should be familiar. Log into your Amazon Affiliate account.Click on “Build Link/Widgets”.Click on “Product Links”.Search for the product you desire to showcase.Click on the corresponding “Get HTML” button. At this point, you cannot use the fancy “Text an Image (Enhanced Display)” option. The next best thing is to use the “Image Only (Basic Display)” option. Under “1. The Tricky Part

How to build React apps on top of the WordPress REST API UPDATE 06/16/2017:I updated the project to use ReactRouter 4 and Webpack 2. Some parts were refactored and simplified. Included links to the frontend React demo and Wordpress backend demo. WordPress is a powerful content management tool. There’s a light at the end of the tunnel, though! You no longer need to have a local WordPress installation and deal with setting up vhosts. In this article I’m going to use ReactJS to build the front end part of the application, React Router for routing, and Webpack for bundling it all together. The stack looks like this:- ReactJs- React Router v4- Alt (for Flux implementation)- Webpack v2 GitHub repo: frontend demo url: backend demo url: demoPass: wp-react-demo Project setup Let’s name the project “wp-api-react”. Install webpack and webpack-dev-server globally as well if you have not done this already:

Members Members is a plugin that extends your control over your blog. It's a user, role, and content management plugin that was created to make WordPress a more powerful CMS. The foundation of the plugin is its extensive role and capability management system. Plugin Features: Role Manager: Allows you to edit, create, and delete roles as well as capabilities for these roles.Content Permissions: Gives you control over which users (by role) have access to post content.Shortcodes: Shortcodes to control who has access to content.Widgets: A login form widget and users widget to show in your theme's sidebars.Private Site: You can make your site and its feed completely private if you want. Professional Support If you need professional plugin support from me, the plugin author, you can access the support forums at Theme Hybrid, which is a professional WordPress help/support site where I handle support for all my plugins and themes for a community of 40,000+ users (and growing). Plugin Development Donations

Related: