Contents

Templates and overrides - Plugixa Exam

Every front-end page is a PHP template, and every one can be overridden from your theme.

The templates

templates/frontend/
  catalogue.php     the list of exams
  exam.php          one exam, with its Start button
  take.php          the runner
  result.php        one result
  results.php       the results list
  portal.php        the learner portal
  certificates.php  the certificate wallet
  parts/            the pieces they share

Overriding one

Copy the file into your theme, keeping the path below a plugixa-exam folder, and edit the copy. The plugin uses yours if it exists and its own otherwise.

Copy only what you are changing. Every file you copy is a file you have taken responsibility for keeping in step with plugin updates.

Before you override

Two lighter options usually do the job.

CSS. The markup carries classes, and the three colour swatches in General settings are variables. A restyle rarely needs a template.

Filters. Most of the payloads have one: plugixa_exam_frontend_catalogue, _exam, _result, _attempt, plugixa_exam_runner_question, plugixa_exam_question_output. Changing the data survives updates in a way that changing the markup does not. See Hooks.

The runner deserves care

take.php is the one to think hardest about. It is a real HTML form before it is anything else, which is what makes the exam work with JavaScript switched off.

An override that assumes JavaScript will run - moving the submit button into a script, or rendering options into a container the scripts fill - removes that guarantee silently. It will look fine in your browser and fail on a locked-down exam machine.

Assets on builder pages

Only post content is inspected when deciding whether to load the front-end bundle. A shortcode stored in a page builder’s own storage is invisible at that point, so opt in:

add_filter( 'plugixa_exam_needs_frontend_assets', function ( $needed ) {
    return $needed || is_page( 'my-builder-page' );
} );

Troubleshooting

Symptom Usual cause
The override is ignored The path under the theme does not match the plugin’s.
The page broke after a plugin update An overridden template is now out of step. Diff it against the plugin’s current version.
Styles missing on a builder page The asset filter above.
The runner stopped working without JavaScript An override that assumes scripts. Compare with the shipped take.php.

What to do next

Quick Links