1. Home
  2. Knowledge Base
  3. FAQ
  4. How to create a Single Location Template

How to create a Single Location Template

Please make sure you are using the most recent version of Open User Map PRO. You need to enable the Public pages for locations (Single pages) feature in the settings:

Creating a template with WordPress Site Editor

If your theme supports FSE (Full Site Editing) an Editor is available in the WordPress Dashboard under Appearance > Editor:

Here is a good article on how to use the Editor to create a custom single template.

To render individual values of the location inside the single template use this shortcode:

[open-user-map-location value="Favorite color"]

See Open User Map > Settings > Help & Getting Started > Additional Shortcodes to learn which values you can get.

Creating a template with Elementor

Here is a detailed article on how to use Elementor to create a custom single template.

To render individual values of the location inside the single template use this shortcode:

[open-user-map-location value="Favorite color"]

See Open User Map > Settings > Help & Getting Started > Additional Shortcodes to learn which values you can get.

Creating a template with code

This should be your fallback method if none of the above works for you. Please see the WordPress Developer Handbook to get the basic infos on how to start (PHP skills are helpful).

  1. Duplicate the single.php file inside your theme folder
  2. Rename it to single-oum-location.php
  3. Edit the file and make use of the do_shortcode() or oum_get_location_value( $value, $post_id ) PHP function to display values from the location (see Open User Map > Settings > Help & Getting Started > Additional Shortcodes to learn which values you can get)

Example Code for a single-oum-location.php

PHP
<?php get_header(); ?>

<?php while ( have_posts() ) : the_post(); ?>

  <h1><?php echo do_shortcode( '[open-user-map-location value="title"]' ); ?></h1>

  <label>Marker Category:</label>
  <?php echo do_shortcode( '[open-user-map-location value="type"]' ); ?>

  <label>Image:</label>
  <?php echo do_shortcode( '[open-user-map-location value="image"]' ); ?>

  <label>Map:</label>
  <?php echo do_shortcode( '[open-user-map-location value="map"]' ); ?>

  <label>Description:</label>
  <?php echo do_shortcode( '[open-user-map-location value="text"]' ); ?>

<?php endwhile; ?>

Important: You need to make sure to call the do_shortcode() functions inside the post loop.

Was this article helpful?

Related Articles


EN