• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
  • Docs
  • Support
  • Account
Pongos Interactive

Pongos Interactive

Websites and Mobile Apps That Work

  • About
  • Solutions
    • Small Business Website Packages
    • Search Engine Optimization (SEO)
    • WordPress Website Maintenance
  • Our Work
  • Testimonials
  • Blog
  • Contact Us

Use a Query Shortcode

Home / Documentation / Use a Query Shortcode


Return to Display Queries on Your Site

Queries can be displayed using a custom shortcode that is generated for each query.

Shortcodes are little phrases enclosed in brackets that can be added to any post, page, or other content.  (They can also be added in the HTML blocks of any Template.)  They look like this:

[shortcode_name]

On your site, WordPress will convert the shortcode into the actual thing for which it is serving as a placeholder — in this case, the query.

To use a query shortcode:

  1. Go to Creator > Queries.
  2. Locate the “Shortcodes” column among the list of queries.
  3. Highlight and copy the shortcode of the query you wish to display.
  4. Go to the page or other location where you wish to add the query.
  5. Paste or type in the query at the location you wish the query to appear.
  6. Save the page.

The query will now appear on that page.

Advanced

Shortcodes can sometimes make use of attributes, or options you can add to a shortcode to adjust its use. A shortcode with an attribute looks like this:

[shortcode_name attribute_name=”Attribute Value”]

All query shortcodes have two default attributes:

  • context – accepts “form” or “results”.  Setting this means you are forcing only the query’s search form to display, or only the query’s results.
  • results_page – accepts any URL.  For shortcodes that are set as context=”form”, this URL tells the search form where to redirect to after submitting.

As an example, let’s say you want to display a search form on your homepage, but once the form is submitted, you want to send users to an interior page to view the results.  In the homepage, you would add:

[sample_query context=”form” results_page=”https://www.example.com/my-interior-page”]

In the interior page, you would add:

[sample_query context=”results”]

These attributes are analogous to the widget options described here.

Developer Note

In addition to “context” and “results_page”, query shortcodes can accept certain arguments used by the WP_Query and WP_User_Query objects (depending on whether you are querying content or users) to limit the results that are returned.

For example, let’s say you have a query that lists all pages.  At the bottom of some of your pages, you want to show a list of that page’s child pages.  You could create multiple queries, or you could create one query and modify it by adding the following to the shortcode:

[sample_query parent=”67″] [sample_query parent=”151″]

These shortcodes would only return results if the result had a parent page whose ID was 67 and 151, respectively.

Busy on the computer

Want to work with us?

We would love to hear from you.

Get Started

Quick Links

  • Home
  • Documentation
  • Support
  • Contact Us
  • My Account

Services

  • Small Business Websites
  • Search Engine Optimization (SEO)
  • WordPress Website Maintenance
  • Website Success Academy

Connect

  • Facebook
  • Twitter
  • LinkedIn
  • YouTube

Pongos Interactive · 1123 MD-3, #118, Gambrills, MD 21054 · (410) 774-9003
Copyright © 2025 · Pongos Interactive · All Rights Reserved