Before diving into the specifics of the query source for the Advanced Grid Builder plugin, it’s important to understand some foundational concepts. At its core, WordPress is a Content Management System (CMS), which means it’s a tool that helps you create, manage, and modify content on your website without needing to interact directly with the code. WordPress organises the data you input—like posts, pages, and media—in a specific structure. This data is stored in a database, like a vast digital library, making it possible for different parts of your website to access and display this content. Now, when we talk about a “data source” for a plugin like Advanced Grid Builder, we’re referring to the specific part of that database the plugin should look at to find the content it needs to display. It’s like telling the plugin exactly which shelf in the library to find the book it needs. Understanding the query source, then, is about defining the instructions to guide the plugin to the right location in the database. This is crucial to ensure the plugin displays the correct content in the desired way on your website.
Also in the world of WordPress, ‘taxonomies’ hold a significant role. Picture taxonomies as a sorting system in a vast library. Each book in the library (or piece of content on your website) can have various attributes, like the author, genre, or publication date. In WordPress, these attributes are called “taxonomies”, and they help to categorise and organise content. The two default taxonomies in WordPress are “Categories” and “Tags”, but you can also create custom taxonomies tailored to your specific needs. For instance, if you were running a travel blog, you could create a taxonomy called “Destinations”. Then, each post could be categorised by the destination it’s about, making it easier for your visitors to find all posts about “Sydney” or “Melbourne”. Understanding taxonomies allows you to structure your content in a more organised, user-friendly way, enhancing the experience for your website’s visitors.
Query Source Fields
The Query Source Fields are a feature of the Advanced Grid Builder plugin that allows you to specify the WordPress data source that will be used to populate your grid. There are four options available:
By selecting “Post Type”, you can choose a specific WordPress post type to populate your grid. The dropdown menu will be prepopulated with all registered WordPress default and custom post types, making it easy for you to select the one you need.
If you select “Taxonomy”, you’ll then choose a specific taxonomy from the dropdown menu. This menu will include all default and custom taxonomies that are registered with your WordPress installation. This option allows you to populate your grid with terms from the selected taxonomy.
By choosing “Media Library”, you can populate your grid with content from the WordPress Media Library. This is a great option if you want to create a grid of images.
To understand this option, let’s step into another fundamental aspect of WordPress: the Loop and archive pages. Imagine you’re watching a slide show. The projector (WordPress) uses a carousel (the Loop) to display each slide (a piece of content) on the screen (your website). The Loop is essentially the heart of WordPress, constantly cycling through your content and displaying it based on specific criteria.
An “archive page” in WordPress is like a summary or a catalogue of all the slides on a particular topic. Let’s go back to our library analogy: if the taxonomies are the sorting system, then the archive page is a special bookshelf that gathers all books of a certain genre, author, or other taxonomy term. For example, an archive page could display all posts from the “Sydney” category of our hypothetical travel blog.
The beauty of the Advanced Grid Builder plugin is its ability to work with the Loop and archive pages. When you select “Loop” as your query source, it tells the plugin to populate your grid based on the current carousel – whether that’s a specific category, a date range, an author, or any other criteria. This is particularly useful for archive pages, where the grid content can dynamically change based on the specific archive page that’s loaded. This flexibility makes it possible to create diverse and dynamic displays of content on your WordPress site.
Selecting “Loop” will populate your grid based on the current query source applied to the WordPress Loop. This is particularly useful for pages like taxonomy archive pages, where the grid content will change based on the specific archive page that’s loaded.
Depending on your Query Source selection, additional fields may appear that allow you to filter the query source to a set of taxonomy terms. These fields include:
Here, you can select a taxonomy or ‘IDs’ from the dropdown menu. This menu will include all default and custom taxonomies registered with your WordPress installation, as well as an ‘IDs’ option. If you select ‘IDs’, you can provide the IDs in the ‘Filter Term Slug’ field, and the posts will be filtered according to the filter operator. While IDs are not a taxonomy, this option has been included in the dropdown for simplicity and ease of use.
You can choose “In” or “Not In” as the operator that will be applied to the supplied terms or IDs. This determines whether the grid includes or excludes content tagged with the specified terms or IDs.
Filter Term Slug
In this field, you can enter a term slug (not a term name) or IDs. You can provide multiple term slugs or IDs, separated by commas. Alternatively, you can select a magic field from the dropdown menu to dynamically populate the filter terms based on the selected field when the grid loads. This can be useful for filtering the grid based on the page title, the terms attached to a post when the grid is included in a generic template, or specific post IDs.
Only Attach Terms to the Current Post
This option is only applicable to the Taxonomy filter option. By selecting this, the grid will only include terms that are attached to the current post.