Tag: PHP

Simple WP_Query Example: Using a Shortcode to Display Post Titles

In this video and text Quick Guide, we present a basic use of WP_Query inside a WordPress shortcode, to show the post titles of the five most recently published posts. We’ve designed this Quick Guide to be a simple intro to using WP_Query in general, as well as to using WP_Query to display post titles and other post data inside a shortcode specifically.







Understanding PHP Globals and Variable Scope in WordPress

One of the most maligned features of WordPress is the use of “PHP global variables.” Whether you love them or hate them, global variables probably aren’t leaving WordPress soon. So today we’ll cover all there is to know about them. How to think about them. How you, in PHP, make variables global, access WordPress’s global variables, and a little about the theory and debate about global state in software applications.



WordPress’s get_template_part() function: What and Why

This article introduces an important concept in WordPress themes: the WordPress get_template_part function. It’s one of the many important concepts of WordPress theme development. Mastering WordPress theme development is an important milestone in understanding WordPress development more generally. (We have a full free course on the topic, check it out.)