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:
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. 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: These functions are well-known, well-documented, and used abundantly in a majority of themes and plugins. The API is quite compact, around only 350 lines of code (the rest are comments). $wp_filter This function is defined on line 6515. Filters ref_array
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.
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. 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. This section of the article goes through the steps you need to follow – and some things you need to to consider – when creating a well-structured WordPress Plugin. Plugin Name
Installation de WordPress 3.0 Multisite avec option sous-domaines : tutoriels, conseils, problèmes et solutions « Bloody Marie Comme je vous en parlais il y a quelques jours, j'ai profité de la configuration de mon nouveau nom de domaine pour mettre en place la fonctionnalité multisite de WordPress. Le principal intérêt étant, avec une seule installation de WordPress, de gérer plusieurs sites/blogs. Ainsi, à chaque mise à jour de WordPress, vous n'aurez plus qu'une seule mise à jour à faire ! Youpiii ! 8) Personnellement, je gère plusieurs sites depuis des années, mais j'ai toujours un peu rechigné à faire mes backups FTP + SQL pour chaque mise à jour de WordPress, d'autant plus que cette manœuvre devait être répétée trois ou quatre fois (une pour chaque site) et prenait un temps fou. Dès que WordPress 3 est sorti, j'ai consacré un week-end à l'installation et au bidouillage de la fonctionnalité Multisite. Installation d'un WordPress multisite NB : personnellement, j'ai installé WordPress multisite avec l'option « sous-domaines » ; c'est donc de ce cas dont je vais parler dans ce billet. Les tutoriels utiles
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. 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. Action Hooks
Un seul hébergement et des centaines de sites Vous avez plein d’idées qui mijotent et vous voulez créer plusieurs blogs ou sites ? Vous vous dites quand même que ça fera cher si vous achetez un nom de domaine et un hébergement pour chaque site… Et bien vous pouvez installer deux ou plusieurs sites sur le même hébergement ! Pour découvrir la configuration nécessaire pour le faire, suivez le guide ! Vous avez besoin de : un hébergement qui accepte le Multi-Domaine (sur OVH c’est inclus dans l’offre “Perso” de base, par contre ce n’est pas le cas dans l’ancienne offre 60GP par exemple)deux ou plusieurs noms de domaine, un pour chaque siteun logiciel FTP, je vous conseille FileZillale téléchargement de WordPresset c’est tout ! J’ai réalisé une vidéo qui vous permettra de rapidement comprendre comment ça se passe (sur OVH uniquement). Résumé des étapes : Voilà donc la fin de ce petit tutorial qui vous permettra d’économiser pas mal d’argent surtout si vous voulez vous lancer dans la création de plusieurs sites statiques.
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. 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're unfamiliar with the concept of a BBCode, and by extension, shortcode, this is how the simplest version looks: There are two more variations you should also be familiar with.