Get AI SEO for FREE.

Learn More!

How to Display Business Location Data on Your Website Using a Shortcode

In this knowledgebase article, we’ll show you how to use Rank Math to display your business location data using shortcodes.

Adding location data becomes even simpler if you’re using the Gutenberg Block Editor. Rank Math offers a dedicated Local Business by Rank Math block that easily adds location data for multiple locations.

Local Business block

However, if you prefer the Classic Editor, the easiest way to add this information to your posts and pages is by using the Location Data shortcode.

Here’s a step-by-step process to get started.

1.1 Access Rank Math’s Schema Generator

In the Classic Editor, locate Rank Math’s Metabox, typically visible at the end after the post-edit area.

Schema Generator in Classic editor

1.2 Open Local Business Schema

Once in the Schema Generator, look for the Local Business Schema and proceed to edit. This will bring up the Schema Builder, where you can find your location’s shortcode.

Shortcode option in Classic editor

The Location ID is the Post ID of the Rank Math Location post that you’ll create for a location: 

Location ID

1.3 Copy and Paste the Shortcode

Copy the shortcode and place it in the Classic editor. Click on Update/Publish to save the changes.

Paste the shortcode

When you view the post, all the information will be added, as shown below.

Information added to the post.

When utilizing Rank Math PRO’s Local SEO Module to create multiple locations, you can effortlessly auto-generate your KML sitemap for business locations.

While you can copy and use the shortcode from the Schema Builder, as we have shown in the previous step, you can also construct one with custom attributes.

Here is an example of the shortcode:

[rank_math_local type="address" locations="297"]

The shortcode pulls location data and requires at least the “type” and “locations” attributes, but more attributes are available for customization.

For instance, if you want to show the address along with the opening hours, the shortcode will be:

[rank_math_local type="address" locations="297" show_opening_hours="true"]

The opening hours and the address will be displayed, as shown below.

Information added using custom shortcode

Let’s now discuss all the attributes in the next section.

Rank Math makes the following attributes available:

This attribute lets you mention the address, opening-hours, map, store-locator. By default, it is set to address.

Accepted values: map, opening-hours, store-locator, address

Default value: address

type

This attribute is the ID of the location to be shown. By default, it is set to show all locations.

locations

This attribute indicates the location to show from a specific Location category.

terms

This attribute indicates the number of location to show.

limit

By default this attribute is set to 1 (true) and displays the name of the company.

Accepted values: 1, 0

Default value: 1

show_company_name

Accepted values: 1, 0

Default value: 1

show_company_address

This attribute displays the company’s address in one line. By default it is set to false.

Accepted values: 1, 0

Default value: 0

show_on_one_line

This attribute displays the State of your Business and by default, it is set to true.

Accepted values: 1 , 0

Default value: 1

show_state

This attribute displays the country’s name of your Business and by default, it is set to 1 (i.e. true).

Accepted values: 1,0

Default value: 1

show_country

This attribute displays the telephone number and by default is set to 1 (i.e. true).

Accepted values:

Accepted values: 1,0

Default value: 1

show_telephone

This attribute displays the secondary number and by default is set to 1 (i.e. true).

Accepted values: 1,0

Default value: 1

show_secondary_number

This attribute displays the fax and by default, it is set to false.

Accepted values: 1, 0

Default value: 0

show_fax

This attribute displays the email address and by default, it is set to 1 (i.e. true).

Accepted values: 1, 0

Default value: 1

show_email

Accepted values: 1, 0

Default value: 1

show_url

This attribute displays the logo and by default, it is set to 1 (i.e. true).

Accepted values: 1, 0

Default value: 1

show_logo

This attribute displays the VAT ID and by default, it is set to false.

Accepted values: true, false

Default value: false

show_vat_id

This attribute displays the tax ID and by default, it is set to false.

Accepted values: 1, 0

Default value: 0

show_tax_id

This attribute displays the chamber of commerce ID and by default, it is set to false.

Accepted values: 1, 0

Default value: 0

show_coc_id

This attribute displays the price range and by default, it is set to false.

Accepted values: 1, 0

Default value: 0

show_pricerange

This attribute displays the opening hours of your business and by default, it is set to false.

Accepted values: 1, 0

Default value: 0

show_opening_hours

This attribute displays the opening hour of a specific day. Default Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday.

Accepted value:

Default value: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday

show_days 

This attribute hides the days when your business is closed or not working. By default, it is set to false.

Accepted values: 1, 0

Default value: 0

hide_closed_days

This attribute displays the Open Now label when a company is currently open based on the user’s timezone. It is enabled by default.

Accepted values: 1, 0

Default value: 1

show_opening_now_label

This attribute adds a note after Opening hours data.

Accepted values:

Default value: Open Now

opening_hours_note

This attribute displays the map and is by default it is set to false.

Accepted values: true, false

Default value: false

show_map

This attribute displays the map style. By default, it shows roadmap.

Accepted values: hybrid, satellite, roadmap, terrain

Default value: roadmap

map_style

This attribute displays the width of the map. By default, it is set to 100%.

Accepted values:

Default value: 100%

map_width

This attribute displays the height of the map. By default, it is set to 300px.

Accepted values:

Default value: 300px

map_height

This attribute displays the map zoom level. By default, it is set to -1.

Accepted values:

Default value: -1

zoom_level

This attribute is used in the map and lets you zoom. By default, it is set to 1 (i.e. true).

Accepted values: 1, 0

Default value: 1

allow_zoom

This attribute is used in the map and allows scrolling. By default, it is set to true.

Accepted values: true, false

Default value: true

allow_scrolling

This attribute is used in the map and allows dragging. By default, it is set to 1 (i.e. true).

Accepted values: 1, 0

Default value: 1

allow_dragging

This attribute is used in the map to display the route planner. By default, it is set to true.

Accepted values: true, false

Default value: true

show_route_planner

This attribute is used in the map and you can use the value from the Settings.

Default value: My Route

route_label

This attribute filters displays filter locations by Category dropdown in Map. By default, it is set to false.

Accepted values: 1, 0

Default value: 0

show_category_filter

This attribute is used in map and by default, it is set to true.

Accepted values: 1, 0

Default value: 1

show_marker_clustering

This attribute is used in map and by default, it is set to true.

Accepted values: 1, 0

Default value: 1

show_infowindow

This attribute displays the radius and is used in the map. By default, it is set to true.

Accepted values: 1, 0

Default value: 1

show_radius 

This attribute displays whether to show the Location nearest to the current location of the user. By default, it is set to true.

Accepted values: true, false

Default value: true

show_nearest_location 

This attribute is used in Store Location to search locations within the given radius – Default 10 in kilometers, can be changed to miles from the Titles & Meta settings as shown below:

Measurement System

Accepted values:

Default value: 10

search_radius

We hope that this tutorial has helped you to display the location data using a shortcode. However, if you still have any queries please feel free to contact our support team and they’d be happy to help you at any given time.

Still not using Rank Math?

Setup takes less than 5 minutes including the import from your old SEO Plugin!

Learn more about the PRO Version

Still need help?

?

Submit Your Question

Please give us the details, our support team will get back to you.

Open Ticket

Related Articles