NgSurvey follow the best practices as defined by WordPress which enables us to customize the output without needing to modify the core files. All HTML content rendered by NgSurvey is structured into the layout files. The layouts can be overridden in your template.
How to override the templates?
Simply copy the desired layout file to
WPROOT/wp-content/themes/YOUR_THEME_NAME folder with the same structure as it is available in the NgSurvey templates folder. For example to override admin/edit_questions.php layout file, copy the file to WPROOT/wp-content/themes/YOUR_THEME_NAME/admin/edit_questions.php.
Below the structure of the template files of NgSurvey.
As shown in above screenshot, there are 3 main folders in the template structure.
- admin – this folder contains all template files for the admin screens such as creation of surveys, viewing reports etc.
- form – the survey creation form templates
- reports – templates of reports pages
- results – templates for survey response result page
- edit_questions.php – this is the main template file which shows the questions form
- survey_options.php – the configuration options of the survey are rendered in a metabox using this file
- survey_reports.php – this is the main template file renders the reports page
- public – This folder contains the templates which render the survey for the front-end users to respond.
- survey – folder contains the survey response page sublayouts
- single_survey.php – main template file which renders the response page layout. The question templates render actual response form of the respective questions.
- success_message.php – the template file which renders the final message after user completes the response.
- questions – This folder contains templates of core question types.
- form – folder contains template files to render question form. each question has one specific file in this folder.
- reports – templates to render the question consolidated report. each question has one specific file in this folder.
- results – templates to render the individual response report, each question has one specific file in this folder.
- survey – survey response templates can be found in this folder. each question type has its own template file in this folder.