background preloader

Codex Wordpress - les pages qui tuent !

Facebook Twitter

Custom Fields. Languages: English • Español • Nederlands • 日本語 Македонски • Português do Brasil • Русский • 中文(简体) • (Add your language) WordPress has the ability to allow post authors to assign custom fields to a post.

Custom Fields

This arbitrary extra information is known as meta-data. This meta-data can include bits of information such as: Mood: Happy Currently Reading: Cinderella Listening To: Rock Around the Clock Weather: Hot and humid With some extra coding, it is possible to achieve more complex actions, such as using the metadata to store an expiration date for a post.

Meta-data is handled with key/value pairs. Keys can be used more than once per post. Here is an example of what this information might look like on your post: Currently Reading: Calvin and Hobbes Today's Mood: Jolly and Happy Function Reference Usage Based upon our example above, let's put this into action. On your next post, you can add a new book and mood to your meta-data. Displaying Custom Fields It might look like this in the source code: 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. 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.

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. 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 <? $recent_posts = wp_get_recent_posts( $args, ARRAY_A );? Return Value. 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 $hook (string) (required) The name of the action to which $function_to_add is hooked. 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. Languages: English • Español • Bahasa Indonesia • 日本語 • 한국어 • Polski • Русский • ไทย • 中文(简体) • 中文(繁體) • (Add your language) Basics of WordPress Theme Design Theme Design WordPress and CSS CSS - Overview of CSS within WordPress, and list of resources related to CSS and WordPress Know Your Sources - External resources on HTML, PHP, and CSS in general CSS Coding Standards - Best practices for coding CSS CSS Troubleshooting - Examining and debugging CSS Right-to-Left Language Support - Working with RTL text using CSS Themes, Templates, and Customization Using Themes - Best starting point for learning about Themes Templates - Comprehensive list of theme and template resources Plugins - Comprehensive list of plugin resources WordPress Plugins and Customization - Other resources related to customizing WordPress.

Site Design and Layout

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). However: if you have a reference to the query object (for example, from within the parse_query or pre_get_posts hooks), you can use the WP_Query conditional methods (eg: $query->is_search()) The Conditions For ... 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. Page Templates. Page Templates Pages are one of WordPress's built-in Post Types. 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): Select a Template from the list (e.g., My Custom Page). All Pages Screen: The Quick-Edit and Bulk Edit options on the All Pages screen also have Template dropdowns. Class Reference/WP Query. Languages: English • Italiano • 한국어 • 日本語 • 中文(简体) • Português do Brasil • (Add your language) Description WP_Query is a class defined in wp-includes/class-wp-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. There are two main scenarios you might want to use WP_Query in. The second is during The Loop. Usage Standard Loop. 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).