The Yelp! Business Listings shortcode inserts a grid of businesses matching the given term and location.
Setup
Before using Yelp in your Content Group, you’ll need to:
- Follow the steps to create and store your Yelp API Key at https://www.wpzinc.com/documentation/page-generator-pro/settings-integrations/#yelp
Adding: Classic Editor / TinyMCE
To add Yelp! Business Listings within the Classic Editor:
- Ensure that you’re using the Visual Editor by clicking the Visual tab:
- Click the Yelp icon in the Visual Editor toolbar (between Wikipedia and YouTube):
Adding: Classic Editor / TinyMCE: Text Editor
If you’re using the Text editor instead of the TinyMCE Visual Editor above:
- Click the Yelp button in the toolbar:
Adding: Gutenberg
To add Yelp! Business Listings within Gutenberg:
- Click the plus icon between two existing blocks, or towards the top left corner of the Gutenberg editor
- Start typing Yelp into the Search for a block field, and click the Yelp option that appears within the Page Generator Pro section
- Follow the Configuration section below for each of the fields displayed in the right hand sidebar’s block panel:
Adding: Page Builders
To add Yelp! Business Listings within any Page Builder that supports a Text Editor widget/module using the Classic Editor (sometimes known as TinyMCE), refer to the Classic Editor instructions above.
Refer to the Dynamic Elements Documentation for details specific to your Page Builder.
If your Page Builder does not provide a Text Editor widget/block that uses the Classic Editor, you can still use Dynamic Elements. However, you’ll need to manually build the shortcode, inserting it into your Page Builder’s content – for example:
[page-generator-pro-yelp parameter="value" ...]
Parameter | Accepted Value | Description |
---|---|---|
term | string or keyword | Business term(s) to find matching results for (e.g. Restaurants) |
location | string or keyword | The city to display Yelp Business Listings for, or use a keyword (e.g. Birmingham or {city}). This should include a country, for example {city}, UK |
radius | 0 to 20 | The maximum radius area to search. |
minimum_rating | 0 to 20 | The minimum rating a business listing must have to be displayed.
As this is not supported by Yelp, using this option may result in fewer results than the Number of Listings option specified. This is because the maximum number of Listings (50) are fetched, and then each Listing is checked to see if it meets or exceeds the Minimum Rating. In some cases, this may result in fewer or no applicable Listings being displayed. |
locale | string | The language to output results in. This must match a Code listed at https://www.yelp.com/developers/documentation/v3/supported_locales |
price | 0 to 4 | Only display listings matching or exceeding the given Price Level (0 = any, 4 = most expensive) |
limit | 1 to 50 | The number of Yelp! Business Listings to display (e.g. 5) |
sort_by | string | How to sort listings
|
output_type | list,table | The output type for the business listings:
|
columns | 1 to 4 | When Output Type = list: The number of columns to display Business Listings in. Any number from 1 to 4 is accepted. |
link | 0 or 1 | If enabled (1), clicking the Business Name, Image or Rating will open a new browser tab/window showing the Business Listing on Yelp’s web site. |
image_width | integer | The maximum width of each Business’ Image / Logo, in pixels. Zero = the full size image will be displayed. Some Themes may not apply width limitations to images, resulting in incorrect layout of the Yelp Dynamic Element. Therefore, it’s recommended to set a sensible value of between 100 and 300 to ensure the layout works correctly. There’s no single ‘best’ number here, so experiment accordingly. |
image_alt_tag | string, keyword or tag | The alt tag for the image. Keywords are supported, and the following tags will output business-specific information:
|
display_order | string | The order to display each Business’ attributes.
This is a comma separated list accepting the following values:
For example:
If blank or not defined, Related Links will each display content in the order Business Name, Image, Rating, Categories, Phone, Address |
display_alignment | string | When Output Type = list: The alignment of each individual Business’ attributes:
|
Configuration: Search Parameters
- Term: Business term(s) to find matching results for (e.g. Restaurants)
- Location: The city to display Yelp Business Listings for, or use a keyword (e.g. Birmingham, UK or {city}, UK). This should include a country, for example {city}, UK
- Radius: The maximum radius, in miles, from the Location to include Business Listings for.
- This cannot exceed 20 miles.
- Minimum Rating: The minimum rating a business listing must have to be displayed.
- As this is not supported by Yelp, using this option may result in fewer results than the Number of Listings option specified. This is because the maximum number of Listings (50) are fetched, and then each Listing is checked to see if it meets or exceeds the Minimum Rating. In some cases, this may result in fewer or no applicable Listings being displayed.
- Language: The language to output results in.
- Price: Only display listings matching or exceeding the given Price Level
- Number of Listings: The number of Yelp! Business Listings to display (e.g. 5)
- Sort Listings: How to sort listings
Configuration: Output
- Output Type: The type of listings that you want to output:
- Grid/List: Displays a grid or list of business listings
- Table: Displays a table of business listings
- Number of Columns: The number of columns to display business listings in. Not applicable when Output Type = Table.
- Link: If enabled, clicking the Business Name, Image or Rating will open a new browser tab/window showing the Business Listing on Yelp’s web site.
- Image Width: The maximum width of each Business’ Image / Logo, in pixels. Zero = the full size image will be displayed.
- Some Themes may not apply width limitations to images, resulting in incorrect layout of the Yelp Dynamic Element. Therefore, it’s recommended to set a sensible value of between 100 and 300 to ensure the layout works correctly.
- There’s no single ‘best’ number here, so experiment accordingly.
- Image Alt Tag: If defined, outputs the given text as the image’s alt tag. Keywords are supported, and the following tags will output business-specific information:
- %business_name%: Business Name
- %business_address1%: Business Address, Line 1
- %business_address2%: Business Address, Line 2
- %business_address3%: Business Address, Line 3
- %business_city%: Business City
- %business_zip_code%: Business ZIP / Postal Code
- %business_country%: Business Country
- %business_state%: Business State Code
- %business_display_address%: Business’ Display Address (e.g. 123 Main Street, City, State Zip Code)
- %business_phone%: Business Phone Number (e.g. +1234567890)
- %business_display_phone%: Business Display Phone Number (e.g. (123) 456-7890)
- %business_distance%: Distance from Search Point
- %business_categories%: Business Categories
- Display Order: Defines the content display order for each Business
- Click the field to see the available options
- Click each option that you want to display
- Drag and drop each option to change the display order
- Click the field to see the available options
- Display Alignment: Defines the alignment of content within each individual Business:
- Vertical: Each Business’ attributes are output in the Display Order from top to bottom (in this example, Business Name, Image and Rating, in a two column layout).
- Horizontal: For each Business, the first Display Order attribute will be displayed, with the remaining Display Order attributes displayed to the right (in this example, Image, Business Name, Rating, in a two column layout):
- Vertical: Each Business’ attributes are output in the Display Order from top to bottom (in this example, Business Name, Image and Rating, in a two column layout).
Common Issues
Yelp Shortcode Error: VALIDATION_ERROR: Field locale: Value ‘en’ does not match ‘^[a-z]{2,3}_[A-Z]{2}$’
You must specify a valid Language / locale, by either:
- Shortcode / Gutenberg Block: Choosing a language from the dropdown list of available languages
- Manual Shortcode: Specifying a value matching a Code at https://www.yelp.com/developers/documentation/v3/supported_locales