background preloader

Post Types

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.

Function Reference/register post type Function Reference/register post type Languages: English • 中文(简体) • 日本語 • (Add your language) Description Create or modify a post type. register_post_type should only be invoked through the 'init' action. It won't work at all if called before 'init', and aspects of the new post type will work incorrectly if called later. Taxonomies When registering a post type, always register your taxonomies using the taxonomies argument. Even if you register a taxonomy while creating the post type, you must still explicitly register and define the taxonomy using register_taxonomy(). Reserved Post Types The following post types are reserved and used by WordPress already. post page attachment revision nav_menu_item In addition, the following post types should not be used as they interfere with other WordPress functions. action order theme In general, you should always prefix your post types, or specify a custom `query_var`, to avoid conflicting with existing WordPress query variables. Usage Parameters $args

Showing custom post types on your home/blog page In the last few days, I’ve shown a few people a screenshot of something I’ve been working on for this site. The screenshot is of a home page displaying custom post types and not just the post post type. After numerous requests for the code to do this, I figured it’d be much easier to share it here. WordPress version 3.0 will make creating custom post types extremely simple. Changing the post type on the home page By default, WordPress shows the post post type on your home page. page (yes, regular pages)albummoviequote To add these, open your theme’s functions.php file and paste this PHP code into it: add_filter( 'pre_get_posts', 'my_get_posts' ); function my_get_posts( $query ) { if ( is_home() && $query->is_main_query() ) $query->set( 'post_type', array( 'post', 'page', 'album', 'movie', 'quote' ) ); return $query; } That’s all there is to it. Showing the post types in your feed if ( is_home() && $query->is_main_query() ) We’ll use the is_feed() conditional tag:

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. 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.

Custom Post Type: come strutturare i nostri contenuti? Grazie all’introduzione dei Custom Post Type in WordPress 2.9, il nostro motore di blogging preferito ha fatto l’ultimo passo che lo separava dal diventare un vero e proprio CMS. In questa serie di articoli vedremo come sfruttare le potenzialità di questa funzionalità per strutturare al meglio i nostri contenuti. Cosa sono i Custom Post Type? Un Post Type è una tipologia di contenuto gestibile da WordPress (infatti a mio avviso il nome Post Type è fuorviante, sarebbe più corretto parlare di Content Type). Un’installazione standard di WordPress contiene 5 Post Type predefiniti: PostPageAttachmentRevisionsNav Menu Per avere una visione più chiara, prendiamo come esempio i post e le pagine, che sono le tipologie con cui abbiamo più familiarità. Quindi post e pagine rappresentano due tipi di contenuto diversi, con caratteristiche diverse. Organizziamo i nostri progetti In molti siti web personali si sente l’esigenza di creare una sezione per mostrare al mondo i propri progetti personali.

Building a Site with New WordPress 3.0 Content Types: Part 1 of Several I’ve been happily tinkering with the beta version of WordPress 3, down in the bowels of the code, mixing unmarked vials of PHP over open flames, etc for a brand new NMC site. The main thing I have been working on are exploiting the feature to create my own types of content with their own properties. Essentially up to know you could create two kinds of content- posts and pages, with pretty much the same feature. My Dog content type would live outside the blog content, so they would not appear as posts, but I could create templates to display them and the additional data, I could build sidebar widgets, I can make archives, do all kinds of things. Before I slip too much into jargon, let me say that everything I have done is by hand coding, and is not meant as the means this will likely be done in the future. I will first show and talk about the (almost, ’cause its never quite done) final site. A few notes about this site: It was meant to be heavy on the visuals.

Setting up Custom Content Types in WordPress 3.0 cc licensed flickr photo shared by TakenByTina My previous post just outlined the kinds of things I put into a new site created with a beta version of WordPress 3 (I started with the first beta and honestly, it had more polish than most finished products) – I actually did not tell you much. Now it’s time to get out and start hacking. In this post, I’ll detail what I did to create three content types on the MIDEA site. While there is an excellent plugin for creating custom content types (I did try it out and also parsed through the code to see what it did), it only did about 15% of what I wanted. Please put your safety goggles on now. This was a huge, and seemingly “doh”-like realization of the power of a single file inside most “beyond the basic” WordPress templates. But I’d done a of of template hacking and left a lot of code in the templates that would have been cleaner and more re-useable in this file. Thats my disclaimer. 1.<? 3.add_action('init', 'midea_custom_init'); 01.<? 09. 10. 11.

MU Domain Mapping Install the plugin in the usual way into the regular WordPress plugins folder. Network activate the plugin.Move sunrise.php into wp-content/. If there is a sunrise.php there already, you'll just have to merge them as best you can.Edit wp-config.php and uncomment or add the SUNRISE definition line. If it does not exist please ensure it's on the line above the last "require_once" command. define( 'SUNRISE', 'on' );As a "super admin", visit Super Admin->Domain Mapping to create the domain mapping database table and set the server IP address or a domain to point CNAME records at.Make sure the default Apache virtual host points at your WordPress MU site or WordPress 3.0 network so it will handle unknown domains correctly. On some hosts you may be required to get a dedicated IP address. A quick check: in a web broswer, type in the IP address of your install. Illustrated installation instructions can be found here but you can ignore the instructions to place domain_mapping.php in mu-plugins.

fr:Thèmes Enfant Languages: English • Español • Français • Italiano • Themes 日本語 한국어 • Македонски • Nederlands • Português do Brasil • Русский • Slovenčina • ไทย • 中文(简体) • 中文(繁體) • (Add your language) Un thème enfant WordPress est un thème qui hérite des fonctionnalités d'un autre thème, appelé thème parent. Le thème enfant est la méthode recommandée pour modifier un thème existant. Pourquoi utiliser un thème enfant ? Il existe quelques raisons qui pourraient vous donner envie d'utiliser un thème enfant : Si vous modifiez un thème existant et qu'il est mis à jour, vos modifications seront perdues. Un thème enfant est composé d'au moins un répertoire (le répertoire du thème enfant) et deux fichiers obligatoires. La première étape dans la création d'un thème enfant est de créer le répertoire du thème enfant, qui sera placé dans wp-content/themes. L'étape suivante consiste à créer la feuille de style de votre thème enfant (style.css). Veuillez noter les éléments suivants Fichiers de Modèle <? if (! Support RTL

Related: