Skip to main content

Auto Search and Replace in Site Templates (v2)

This tutorial requires WP UItimo version 2.x.

One of the most powerful features of Ultimate Multisite is the ability to add arbitrary text, color, and select fields to the registration form. Once we have that data captured, we can use it to pre-populate the content in certain parts of the site template selected. Then, when the new site is published, Ultimate Multisite will replace the placeholders with the actual information entered during registration.

For example, you can do your template sites with placeholders. Placeholders should be added surrounded by double curly braces - {{placeholder_name}}.

Then, you can simply add a matching registration field to capture that data

Your customer will then be able to fill that field during the registration.

Ultimate Multisite will then replace the placeholders with the data provided by the customer automatically.

Solving the "template full of placeholders" problem

All of that is great, but we do run into an ugly problem: now our site templates - that can be visited by our customers - are full of ugly placeholders that don't tell much.

To solve that, we offer the option of setting fake values for the placeholders, and we use those values to search and replace their contents on the template sites while your customers are visiting.

You can have access to the template placeholders editor by heading to Ultimate Multisite > Settings > Sites, scrolling to the Site Template Options area, and then clicking the Edit Placeholders link.

Site Template Options area in the Sites settings page

That will take you to the placeholders' content editor, where you can add placeholders and their respective content.

Template placeholders editor entry point