background preloader

Wordpress

Facebook Twitter

Post Types. Languages: English • 日本語 • Português do Brasil • Nederlands • Slovenčina • (Add your language) WordPress can hold and display many different types of content. A single item of such a content is generally called a post, although post is also a specific post type. Internally, all the post types are stored in the same place, in the wp_posts database table, but are differentiated by a column called post_type. WordPress 3.0 gives you the capability to add your own custom post types and to use them in different ways.

Default Post Types There are five post types that are readily available to users or internally used by the WordPress installation by default : Post (Post Type: 'post') Page (Post Type: 'page') Attachment (Post Type: 'attachment') Revision (Post Type: 'revision') Navigation menu (Post Type: 'nav_menu_item') Post Post in WordPress is a post type that is typical for and most used by blogs. Page Page in WordPress is like post, but it lives outside the normal time-based listings of posts. Using mod_security 2 with WordPress. Inside WordPress Actions and Filters. Advertisement Gone are the days when WordPress developers, wanting to extend the CMS’ functionality, had to alter and hack WordPress’ source code directly, resulting in headaches when upgrading and sharing modifications.

When WordPress 1.2 rolled out1 back in 2004, a new plugin architecture was introduced that is now commonly referred to as actions and filters, hooks, and the Plugin API. WordPress’ core has been carefully sprinkled with actions and filters that external code (in the form of themes and plugins) can hook into, injecting new functionality into the standard flow.

The Plugin API2 provides a neat interface to work with actions and filters. This article gathers insight into the inner workings, elegance and beauty of the Plugin API. Warning This is a detailed walkthrough of some of WordPress’ core source code. The Plugin API The functions that theme and plugin developers most commonly use are these: The API is quite compact, around only 350 lines of code (the rest are comments). Writing a Plugin. Languages: English • العربية • বাংলা • Español • Italiano • a Plugin 日本語 한국어 • Português do Brasil • Русский • ไทย • 中文(简体) • (Add your language) WordPress Plugins allow you to easily modify, customize, and enhance a WordPress site. Instead of changing the core program code of WordPress, you can add functionality with WordPress Plugins.

Here is a basic definition. A WordPress Plugin is a program or a set of one or more functions written in the PHP scripting language, that adds a specific set of features or services to the WordPress site. You can seamlessly integrate a plugin with the site using access points and methods provided by the WordPress Plugin Application Program Interface (API).

Wish that WordPress had some new or modified functionality? This article assumes you are already familiar with the basic functionality of WordPress and with PHP programming. Resources To understand how WordPress Plugins work and how to install them on your WordPress blog, see Plugins. Plugin Name Home Page. Create a Custom WordPress Plugin From Scratch. This tutorial will describe the implementation of a Wordpress plugin starting from scratch. The plugin will connect to an external OSCommerce database and display random products on your Wordpress site. It also implements a configuration page for the Wordpress admin panel. 1. Introduction Wordpress is gaining more and more popularity each day, not just as a blogging platform but also as a basic CMS, thus improving and extending its basic functionality becoming a day-to-day necessity for a lot of developers.

In today's tutorial we'll be talking about creating a Wordpress plugin that extracts and displays products from an external OSCommerce shop database. 2. While it would be possible to follow this tutorial by simply reading through it, I would recommend installing Wordpress on your computer and follow the tutorial implementing all the steps. Further on, you will need to set up an OSCommerce shop on your machine. 3. First, we'll need to create our basic files and folder structure. 4. 5. How to Create WordPress Shortcodes. One of the primary reasons why WordPress is the most popular CMS platform available is the sheer level of customizability that it brings to the table.

Today, we'll review the process of integrating one of those popular features, shortcodes, in the most user friendly way possible, into our theme. Even though there are a few trillion options to choose from, WordPress has comfortably taken the crown as the king of CMSs and blogging platforms with its incredible flexibility. A shortcode is one of those features that ratchet up the user friendliness of the system. However, most implementations still require you to remember the shortcode itself. When you've created a masterpiece of a theme, the usability shouldn't really lag behind. It's called a shortcode and it has been part of the base WordPress installation since it hit version 2.5.

Here, you can define your own codes to use within your theme. If you've ever embedded a gallery with WordPress, you've already used a shortcode! Questions? Template_Hierarchy.png (1453×1443) Template Hierarchy. Languages: English • Français • Italiano • 日本語 • 한국어 • Русский • Español • Português do Brasil • 中文(简体) • (Add your language) Introduction WordPress Templates fit together like the pieces of a puzzle to generate the web pages on your WordPress site. Some templates (the header and footer template files for example) are used on all the web pages, while others are used only under specific conditions. What this article is about This article seeks to answer the following question: Which template file(s) will WordPress use when it displays a certain type of page? Who might find this useful Since the introduction of Themes in WordPress 1.5, Templates have become more and more configurable.

Using Conditional Tags WordPress provides more than one way to match templates to query types. The Template File Hierarchy The General Idea WordPress uses the Query String — information contained within each link on your website — to decide which template or set of templates will be used to display the page. Examples. Wordpress Reference Guide 3.0+ Presented by: Get Attachment Link get_attachment_link(); Returns the URI of the page for an attachment. $id Integer • Default: The current post ID, when used in The Loop. (Optional) The numeric ID of the attachment. Is Attachment is_attachment(); This Conditional Tag checks if an attachment is being displayed. The Attachment Link the_attachment_link(); Outputs a hyperlink to the attachment file, or Missing Attachment if the attachment can't be found. Integer • Default: the ID of the current post (Optional) ID of the desired attachment. $fullsize Boolean • Default: false (Optional) For an image attachment, use the original image (true) or Wordpress-generated thumbnail (false).

$permalink (Optional) Link to the attachment page (true) or directly to the file/image (false). WP Attachment Is Image wp_attachment_is_image(); This function determines if a post's attachment is an image. $post_id Integer • Default: 0 Integer ID of the post. WP Get Attachment Image wp_get_attachment_image(); $attachment_id $size. Inline Documentation. Coding Standards. Administration Menus. Administration Menus Languages: English • 中文(简体) • 日本語 • Русский • (Add your language) Introduction Usually, plugin and theme authors need to provide access to a settings (options) screen so users can customize how the plugin or theme is used.

The best way to present the user with such a screen is to create an administration menu item that allows the user to access that settings screen from all the Administration Screens. Function Reference Every Plot Needs a Hook To add an administration menu, you must do three things: Create a function that contains the menu-building code Register the above function using the admin_menu action hook. It is that second step that is often overlooked by new developers. Here is a very simple example of the three steps just described. <? In this example, the function my_plugin_menu() adds a new item to the Settings administration menu via the add_options_page() function. These processes are described in more detail in the sections below. Dashboard Posts Media Links. Plugin API/Action Reference. Languages: English • Русский • 日本語 • Português do Brasil • (Add your language) This is a (hopefully) comprehensive list of action hooks available in WordPress version 2.1 and above.

For more information: To learn more about what filter and action hooks are, see Plugin API. To learn about writing plugins in general, see Writing a Plugin. (If you want to add to or clarify this documentation, please follow the style of the existing entries. Actions Run During a Typical Request These actions are called when a logged-in user opens the home page in Version 3.3.1. Actions are called with the function do_action(), except those marked (ref array), which are called with the function do_action_ref_array(). Actions Run During an Admin Page Request These actions are run when a logged-in user opens the Posts page in Version 3.3.1. In these actions, (hookname) depends on the page. Post, Page, Attachment, and Category Actions (Admin) post_submitbox_misc_actions add_attachment add_category category_edit_form. 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. 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. Writing a Plugin.