How to Add a Shortcode to My Template?

Simple MPG shortcode is automatically taken and generated from the data source file you upload in your MPG Project. For example, if you have a column “City” and “State”, then MPG will generate {{mpg_city}} and {{mpg_state}} shortcodes that you can use throughout your template page. You can use these in meta description, title, body of the post or page, and anywhere in between.

In this example we have a CSV file with City and State columns, which MPG will use to create shortcodes by forcing lower case format and adding mpg_ to the front of the column name: {{mpg_city}} and {{mpg_state}}

Let’s say that you’ve set up URL Generation in your MPG project to use City and State as your URLs. MPG will generate 3 URLs according to the example above. Those will be:

  • /prairie-ridge-wa/
  • /los-angeles-ca/
  • /new-york-ny/

MPG URL Generation

Loading either of these pages will preload the template page that was set in MPG settings and replace any {{mpg_city}} or {{mpg_state}} shortcodes according to the row in your source file. For example, loading /prairie-ridge-wa/ will replace {{mpg_city}} with Prairie Ridge and {{mpg_state}} with WA.

*Please note that a simple MPG shortcode works only with the specified template page of your MPG Project settings. There are List Shortcodes that generate lists of MPG URLs that can be used on any page of your WordPress, for instance.