Knowledge Base

Search for anything about "All-in-One Video Gallery"

Customizing the Plugin’s Front-End Layouts

This article explains how to override the default All-in-One Video Gallery front-end HTML layout files (also known as “templates”) with your own template files. For consistency, we will always use the term “template” to refer to “Front-end HTML layout files” throughout this tutorial.

Overriding the Default Plugin Template Files

Sometimes, you might want to change the default layout that comes with the All-in-One Video Gallery plugin to better suit your niche. While you could modify the plugin files directly, this is highly discouraged, as your changes will be overwritten when the plugin is updated. The recommended approach is to use the aiovg_load_template filter instead.

Additionally, we recommend creating a Child Theme and placing your overrides inside the Child Theme folder. This ensures that your changes remain update-safe while keeping your customizations organized.

Using the aiovg_load_template Hook

The All-in-One Video Gallery template files are located in the following directory and are responsible for the plugin’s front-end HTML output:

/wp-content/plugins/all-in-one-video-gallery/public/templates/

Note: We will list and explain each file under this directory at the end of this article so you can better understand what each file does and choose the correct one to override.

Before loading the files under this directory, the plugin passes them through a filter hook named aiovg_load_template. This allows developers to override the file and customize it without editing the core plugin files. This also ensures that your changes remain intact after updates.

Example: Modifying the Video Content Using the aiovg_load_template Hook

The filter hook is passed with two arguments:

  1. $template (string) – The default template file path.
  2. $attributes (array) – An associative array of attributes used by the template (optional; not all templates use this argument).

Overriding the single-video.php Template

The single-video.php file inside the template directory is responsible for displaying the video player, description, related videos, etc., on single video pages. The following example overrides the single-video.php file with your own file path inside your Child Theme:

/**
 * Override the single video page template used by the plugin
 * that outputs the video player, description, related videos, etc.
 *
 * @param  string $template   Default template file path.
 * @param  array  $attributes Optional. An associative array of attributes used by the template.
 * @return string             Filtered template file path.
 */
function aiovg_override_single_video_template( $template, $options = array() ) {
    $basename = basename( $template );

    if ( 'single-video.php' == $basename ) {
        return get_stylesheet_directory() . '/aiovg-templates/single-video.php';
    }

    return $template;
}
add_filter( 'aiovg_load_template', 'aiovg_override_single_video_template' );

Steps to Override a Template

  1. Create a directory inside your Child Theme (e.g., aiovg-templates).
  2. Copy the default template file from the plugin (/wp-content/plugins/all-in-one-video-gallery/public/templates/).
  3. Paste it inside your Child Theme directory (e.g., /wp-content/themes/your-child-theme/aiovg-templates/).
  4. Make the necessary modifications to the copied template.
  5. Use the aiovg_load_template filter hook to override the template with your new file path.

This ensures a smooth and update-safe customization process.

Default Template Files and Their Usage

Category Listing Templates

  • categories-template-dropdown.php – Displays categories as an HTML dropdown (used when the categories template is set to “Dropdown”).
  • categories-template-grid.php – Displays categories as a thumbnail gallery (used when the categories template is set to “Grid”).
  • categories-template-list.php – Displays categories as UL – LI lists (used when the categories template is set to “List”).
  • category-thumbnail.php – Displays a single category thumbnail.

Video Listing Templates

  • videos-template-classic.php – Displays videos as a thumbnail gallery (used when the videos template is “Classic”).
  • video-thumbnail.php – Displays a single video thumbnail (used when the “Image Position” is “Top”).
  • video-thumbnail-image-left.php – Displays a video thumbnail (used when the “Image Position” is “Left”).

Single Video & Player Templates

  • single-video.php – Displays video details on the single video page (e.g., https://mysite.com/video/lorem-ipsum/).
  • player.php – Displays the video player.

Search Templates

  • search-form-template-compact.php – Displays a compact keyword-only search form.
  • search-form-template-horizontal.php – Displays a horizontal search form (used when the search form template is “Horizontal”).
  • search-form-template-vertical.php – Displays a vertical search form (used when the search form template is “Vertical”).

Additional Premium Templates

The templates directory for the premium files is:

/wp-content/plugins/all-in-one-video-gallery-premium/premium/public/templates/

The following files belong to the Premium version of the plugin:

  • videos-template-compact.php – Used when videos template is “Compact”.
  • videos-template-popup.php – Used when videos template is “Popup”.
  • videos-template-playlist.php – Used when videos template is “Playlist”.
  • videos-template-inline.php – Used when videos template is “Inline”.
  • videos-template-slider-classic.php – Used when videos template is “Slider” with “Classic” layout.
  • videos-template-slider-compact.php – Used when videos template is “Slider” with “Compact” layout.
  • videos-template-slider-popup.php – Used when videos template is “Slider” with “Popup” layout.
  • videos-template-slider-inline.php – Used when videos template is “Slider” with “Inline” layout.
  • user-dashboard.php – Displays the front-end user dashboard where users can add/edit/delete their videos.
  • video-form.php – Displays the front-end video form for adding/editing videos.
  • user-playlists.php – Displays a list of user-created playlists.
  • single-playlist.php – Displays a single playlist after clicking from user-playlists.php.

Overriding the Whole Single Video Page Layout

To modify the entire page layout (e.g., adding sidebars or changing the header/footer structure), use your theme’s template system.

Steps to Override the Entire Single Video Page Layout

  1. Navigate to your Child Theme directory (/wp-content/themes/your-child-theme/).
  2. Duplicate single.php (or page.php) and rename it to single-aiovg_videos.php.
  3. Modify the layout as needed and save the file.

By using a Child Theme and the aiovg_load_template filter, you can safely override the All-in-One Video Gallery plugin’s front-end layout files without losing changes during updates. This method ensures better maintainability while allowing for maximum customization.

Scroll to Top