background preloader

Wordpress

Facebook Twitter

Plugin API. Plugin API Languages: বাংলা • English • Español • Français • 日本語 • 한국어 • Português do Brasil • ไทย • 中文(简体) • Русский • (Add your language) Introduction This page documents the API (Application Programming Interface) hooks available to WordPress plugin developers, and how to use them.

This article assumes you have already read Writing a Plugin, which gives an overview (and many details) of how to develop a plugin. This article is specifically about the API of "Hooks", also known as "Filters" and "Actions", that WordPress uses to set your plugin in motion. These hooks may also be used in themes, as described here. Hooks, Actions and Filters Hooks are provided by WordPress to allow your plugin to 'hook into' the rest of WordPress; that is, to call functions in your plugin at specific times, and thereby set your plugin in motion. You can sometimes accomplish the same goal with either an action or a filter. Function Reference Actions Modify database data. Create an Action Function Hook to WordPress.

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. 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. If the class is changed to “error” it displays in red. 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.

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. If you're new to web design, you might also enjoy my easy PHP 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. 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. There are also some functions related to actions and filters (the Plugin API), which are therefore used primarily for developing Plugins. The rest are used to create the core WordPress functionality.

Many of the core WordPress functions are useful to Plugin and Theme developers. So, this article lists most of the core functions, excluding Template Tags. 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. 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. Put it wherever the code for your admin page is. You want to have a text input for the image URL, and a button that will launch the uploader dialog. <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. That’s it. WordPress.com - Get a Free Blog Here.