1. AAWP
  2. Documentation
  3. Tips & Tricks
  4. Templating
  1. AAWP
  2. Documentation
  3. Customizations
  4. Templating

Basics

In order to edit PHP templates (depends on your intention) you need knowledge in HTML, CSS and PHP. Additionally it’s recommendable to make use of a special editor like Notepad++ (Windows) or Sublime Text (MacOS).

Note: Please don’t edit original files inside the plugin folder due to the fact that they will be overwritten with the next update!

Editing existing templates

In order to edit existing templates, please go on as follows:

  1. Create a new directory called “aawp” inside your theme/child-theme folder
  2. Copy the template file you want to edit out of the plugin folder (sub-directory “templates)
  3. Insert the file you copied previously (point 2) into the recently created folder (point 1)
  4. Please be aware that you mirror the original folder structure:
    • /templates/table.php” will become “/aawp/table.php” inside your theme
    • /templates/products/vertical.php” will become “/aawp/products/vertical.php” inside your theme
    • etc…
  5. Now you’re ready to edit the file inside your theme how you like to. For example…
    • editing the HTML structure
    • editing or adding CSS classes
    • remove unneeded elements (e.g. description) or simply move them to another place
    • etc…
  6. From now on the plugin will use your edited template instead of the original one

Creating new templates

Not only you are able to edit existing templates but also you can create new ones. This makes sense especially when creating new product presentations which will be used in addition to the basic ones.

In order to edit existing templates, please go on as follows:

  1. Create a new directory called “aawp” inside your theme/child-theme folder
  2. Copy the template file – you want to use as a guideline – out of the plugin folder (sub-directory “templates)
  3. Insert the file you copied previously (point 2) into the recently created folder (point 1)
  4. AAWP is looking for templates by following the this logic:
    • first of all the plugin will look for the template of a single product, which will be found in the sub-directory /products/
    • if nothing found, it will look for a layout template (e.g. “table”) in the root folder
    • depending on your intention, it’s recommendable to replace a single product template only, otherwise you can move the product template content into a layout template as well
  5. Please be aware that you mirror the following folder structure:
    • when creating a new product box, save the new template as following: “/aawp/products/my-box.php
    • when updating the layout around the product box as well, save the template as following: “/aawp/my-box.php” (in this case you might have to copy and paste some come of the layout template as well)
    • more information can be found in the templates documentation
  6. Now you’re ready to edit the file inside your theme how you like to. For example…
    • editing the HTML structure
    • editing or adding CSS classes
    • remove unneeded elements (e.g. description) or simply move them to another place
    • etc…
  7. Afterwards you can set the recently created template as new default template (via plugin settings, tab “functions”) or simply on a shortcode basis. (see Functions – Plugin settings)

Templates located inside your theme/child-theme sub-directory “aawp” won’t be overwritten with the next update of AAWP.

Note: It’s recommendable to go through the plugin changelog after every update and take a look if one of the default templates were updated or extended with new features. In this case you might have to compare and update your own templates as well.

Was this article helpful?

Related Articles