How to exclude some categories from the widget. Exclure une catégorie d'une boucle WordPress. 10 WordPress Template Tags You May Not Know. WordPress is shipped with quite an abundance of Template Tags since its inception.
These Template Tags in WordPress are PHP functions that can be used to output as well as retrieve a piece of data. If you have been developing a WordPress theme, you may be familiar with some of these Template Tags, such as the_title that shows the post title, the_author that shows the name of the post’s author, and the link of the post. How to Create Custom WordPress Template Tags How to Create Custom WordPress Template Tags. WordPress Single Post Templates. I’ve recently released a plugin that is far more robust than the methods outlined below.
It actually duplicates the functionality of WordPress Page Templates, and allows you to create individual post templates, selectable on a per post basis via a dropdown menu. Head over to my WordPress Plugins page and find the “Post Templates Plugin” UPDATED:Austin recommends using a filter in your functions.php file as an alternative to the method below. IMO, his suggestion is much simpler and quite elegant. Here’s the code to add to your theme’s functions.php file. Mastering WP_Query: 10 Useful Examples. Now that we learned almost everything about the WP_Query class, it's time to try out some examples.
In this part, we're going to work on 10 different scenarios to utilize the WP_Query class and related functions. It will be a fun exercise and I hope it will be equally educational. Let's begin! Just to make this article be understandable separately from the "Mastering WP_Query" series, I should do a nano-tutorial on creating WordPress loops with the WP_Query class. It's not different than creating a regular loop, really. Function Reference/query posts. Languages: English • Italiano • 日本語 • 中文(简体) • Português do Brasil • (Add your language) Description Note: This function isn't meant to be used by plugins or themes.
As explained later, there are better, more performant options to alter the main query. query_posts() is overly simplistic and problematic way to modify main query of a page by replacing it with new instance of the query. It is inefficient (re-runs SQL queries) and will outright fail in some circumstances (especially often when dealing with posts pagination). Comment utiliser la requête WP query pour l’affichage de vos articles - Naxialis : développeur, intégrateur Wordpress freelance. Un template hierarchy pour cibler les pages de commentaires : Posez moi la question n°3. The Loop. Languages: English • Français • Italiano • 日本語 • Português do Brasil • Русский • 中文(简体) • 中文(繁體) • (Add your language) The Loop is PHP code used by WordPress to display posts.
Using The Loop, WordPress processes each post to be displayed on the current page, and formats it according to how it matches specified criteria within The Loop tags. Any HTML or PHP code in the Loop will be processed on each post. When WordPress documentation says "This tag must be within The Loop", such as for specific Template Tags or plugins, the tag will be repeated for each post. For example, The Loop displays the following information by default for each post: Custom Page Templates - smashingmagazine. I like to think of WordPress as the gateway drug of web development.
Many people who get started using the platform are initially merely looking for a comfortable (and free) way to create a simple website. Some Googling and consultation of the WordPress Codex1 later, it’s done and that should be it. Kind of like “I’m just going to try it once.” However, a good chunk of users don’t stop there. Instead, they get hooked.