background preloader

Codex Wordpress - les pages qui tuent !

Facebook Twitter

Wp_enqueue_script() Enqueue a script.

wp_enqueue_script()

Description #Description Registers the script if $src provided (does NOT overwrite), and enqueues it. Parameters #Parameters $handle (string) (Required) Name of the script. $src (string) (Optional) Full URL of the script, or path of the script relative to the WordPress root directory. Including CSS & JavaScript. Plugin API. Languages: বাংলা • English • Español • Français • 日本語 • 한국어 • Português do Brasil • ไทย • Русский • (Add your language) Introduction This page talks about the API documentation (Application Programming Interface) available for WordPress plugin developers, shows how developers of plugins can use them.

Plugin API

This article assumes that you've read Writing a Plugin, giving an overview (and many details) of how to develop a plugin. The same speaks specifically about the API "Hooks", also known as "Filters" and "Actions", used by WordPress to set your plugin at runtime. These hooks can 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. LA BASE !! Official WordPress Developer Resources.

Theme Developer Handbook. Function Reference/post type archive title. Languages: English • Italiano • 日本語 • (Add your language) Description Display or retrieve title for a post type archive.

Function Reference/post type archive title

This is optimized for archive.php and archive-{posttype}.php template files for displaying the title of the post type. Usage Parameters. WordPress Coding Standards. The purpose of the WordPress Coding Standards is to create a baseline for collaboration and review within various aspects of the WordPress open source project and community, from core code to themes to plugins.

WordPress Coding Standards

The WordPress community developed the standards contained in this section of the handbook, and those standards are part of the best practices that developers and core contributors are recommended to follow. Why have coding standards? # Coding standards help avoid common coding errors, improve the readability of code, and simplify modification. They ensure that files within the project appear as if they were created by a single person. Following the standards means anyone will be able to understand a section of code and modify it, if needed, without regard to when it was written or by whom. If you are planning to contribute to WordPress core, you need to familiarize yourself with these standards, as any code you submit will need to comply with them. Top ↑

Function Reference/wp get recent posts. Languages: English • 日本語 • Русский • (Add your language) Description Retrieve the most recent posts.

Function Reference/wp get recent posts

Usage Default Usage <? Function Reference/add action. Languages: English • 日本語 • 中文(简体) • 한국어 • (Add your language) Description Hooks a function on to a specific action.

Function Reference/add action

More specifically, this function will run the function $function_to_add when the event $hook occurs. This function is an alias to add_filter(). See Plugin API/Action Reference for a list of action hooks. Usage Parameters. Main Page « WordPress Codex. Theme Development. Languages: বাংলা • English • Español • 日本語 • 한국어 • Português do Brasil • Русский • 中文(简体) • 中文(繁體) • (Add your language) This article is about developing WordPress Themes.

Theme Development

If you wish to learn more about how to install and use Themes, review Using Themes. This topic differs from Using Themes because it discusses the technical aspects of writing code to build your own Themes rather than how to activate Themes or where to obtain new Themes. Site Design and Layout. Conditional Tags.

Conditional Tags Languages: English • Français • Italiano • 日本語 • Türkçe • Português do Brasil • 中文(简体) • (Add your language) Introduction The Conditional Tags can be used in your Template files to change what content is displayed and how that content is displayed on a particular page depending on what conditions that page matches.

Conditional Tags

For example, you might want to display a snippet of text above the series of posts, but only on the main page of your blog. With the is_home() Conditional Tag, that task is made easy. Note the close relation these tags have to WordPress Template Hierarchy. Warning: You can only use conditional query tags after the posts_selection action hook in WordPress (the wp action hook is the first one through which you can use these conditionals). The Conditions For ... All of the Conditional Tags test to see whether a certain condition is met, and then returns either TRUE or FALSE. The Main Page. Templates. Templates Languages: English • Español • Italiano • 日本語 • Русский • (Add your language) Templates are the files which control how your WordPress site will be displayed on the Web.

Templates

These files draw information from your WordPress MySQL database and generate the HTML code which is sent to the web browser. Through its powerful Theme system, WordPress allows you to define as few or as many Templates as you like all under one Theme. Each of these Template files can be configured for use under specific situations. General Theme Articles Using Themes Basic information about using and installing themes and templates Migrating Plugins and Themes. Page Templates. Page Templates Pages are one of WordPress's built-in Post Types.

Page Templates

You'll probably want most of your website Pages to look about the same. Sometimes, though, you may need a specific Page, or a group of Pages, to display or behave differently. This is easily accomplished with Page Templates. Selecting a Page Template Your Theme files should include a default page template (named: page.php). Edit Page Screen: You can assign a custom template for any individual Page by using the Template dropdown in the Edit Page screen (part of the Page Attributes module): Class Reference/WP Query. Languages: English • Italiano • 한국어 • 日本語 • 中文(简体) • (Add your language) Description WP_Query is a class defined in wp-includes/query.php that deals with the intricacies of a post's (or page's) request to a WordPress blog.

The wp-blog-header.php (or the WP class in Version 2.0) gives the $wp_query object information defining the current request, and then $wp_query determines what type of query it's dealing with (possibly a category archive, dated archive, feed, or search), and fetches the requested posts. It retains a lot of information on the request, which can be pulled at a later date. Interacting with WP_Query Most of the time you can find the information you want without actually dealing with the class internals and global variables.

Class Reference/WP Post. Languages: English • Italiano • 日本語 • (Add your language) Role of WP_Post The WP_Post class is used to contain post objects stored by the database and is returned by functions such as get_post. Member Variables of WP_Post As of WordPress Version 3.5.1 Accessing the WP_Post Object To access the member functions of the post object, use this syntax. $examplePost = get_post(); echo $examplePost->ID; // Display the post's ID Please Note: While the above method is fine for retrieving the post ID, you should not use the above method for displaying post_content and other filtered elements (such as post_title).