1. Advanced
  2. Template Files

Template Files

GamiPress is designed to work right out of the box with most WordPress themes. It does this by using a template hierarchy system in the same way WordPress does.

GamiPress blocks, shortcodes and widgets make use of the template system and you can override them by following the next steps:

  1. Navigate to the GamiPress templates directory on /wp-content/plugins/gamipress/templates.
  2. Copy the template file you want to override on /wp-content/themes/your-theme/gamipress.
  3. Make the modifications you want!

Template per type

GamiPress template system includes the ability to place templates by type, so, you can override the achievement.php template just for one of the achievement type you setup by adding a suffix like achievement-{achievement-type-slug}.php.

For example, for “My Badges” achievement type that has the slug “my-badges” you need to copy the /plugins/gamipress/templates/achievement.php file as /your-theme/gamipress/achievement-my-badges.php.

Template hierarchy

GamiPress will priorize template files located on your child theme, following by your theme template and finally on the plugin folder itself.

A template like earnings.php will be loaded from:

  1. /wp-content/themes/child-theme/gamipress/earnings.php
  2. /wp-content/themes/parent-theme/gamipress/earnings.php
  3. /wp-content/plugins/gamipress/earnings.php (Default template file)

For a template that supports to be loaded per type, will load priorize the most specific one, following the next order:

  1. /wp-content/themes/child-theme/gamipress/achievement-{achievement-type}.php
  2. /wp-content/themes/child-theme/gamipress/achievement.php
  3. /wp-content/themes/parent-theme/gamipress/achievement-{achievement-type}.php
  4. /wp-content/themes/parent-theme/gamipress/achievement.php
  5. /wp-content/plugins/gamipress/achievement.php (Default template file)

Add-on’s template files

GamiPress add-ons also make use of this template system and all over-writable templates will be found on the templates directory inside the add-on folder.

The unique difference is add-ons templates should be located inside the add-on directory too, for example, for Daily Login Rewards add-on, template files should be placed on /your-theme/gamipress/daily-login-rewards directory.

Was this article helpful to you? No Yes 2

How can we help?