Show a single entry in a view filtered in the URL

By: Shawn Fawcett | Asked: 06/10/2022
ForumsCategory: How-toShow a single entry in a view filtered in the URL
Shawn Fawcett asked 2 years ago

I have a page where I just want to display a person's name and phone number.
eg Hi Bob. Your phone is 123-4567. This is entry 37
 
Q1: what short code would I need to put in the page to achieve this?
Q2: could I filter to this entry in the URL? If so, how?

1 Answers
Victor Font answered 2 years ago
First, do you have a Plus license or higher? This is required to create views.
  1. If you have a Plus license or higher, when you Create/Edit a View, the shortcode to display it on a page is listed in the left column under the View Name field. (See image).
  2. To pass a value through a URL, you use the [get param] shortcode in the View filter and pass the filter value in a query string. See this knowledge base article: Get a parameter from the URL
Attachments
Shawn Fawcett replied 2 years ago

Thanks Victor. I’ll have a go at it. Seems straightforward

Shawn Fawcett replied 2 years ago

Right, I actually had that already but how do I specify which entry? This just shows 1 entry but not a specific one

Victor Font replied 2 years ago

The value you pass in the query string can be the record's entry_id or another value that's unique to the entry. It could be the phone number, if you want. The query string is formatted as /yourdomain/your view page/?entry=37.

In the View filter you set entry id is equal to [get param = entry].

That's all there is to it.

How are you sending the URL to the user to click on?

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right