English (United Kingdom)
Knowledge Base  >  VikUpdater  >  Developers  >  Themes  >  Subscribe Themes

apply_filters( 'vikupdater_subscribe_themes', array $themes )

Filter used to obtain a list of themes that wishes to use the features provided by VikUpdater.


Description

Themes interested in subscribing themselves can attach the following information to the return array.

Except for theme, version and url; all the other parameters can be specified by the JSON object returned by the "check" url.

name

(string)  The name of the theme, such as "Your Theme" (mandatory).

theme

(string)  The theme identifier, such as "your-theme" (mandatory).

version

(string)  The currently installed version of the theme (mandatory).

tested

(string)  The WordPress tested-up-to version (optional).

requires

(string)  The minimum required version of WordPress (optional).

requires_php

(string)  The minimum required version of PHP (optional).

url

(string)  The URL needed to check the latest version of the theme (mandatory). Must return a JSON object, which supports all the properties specified here.

download

(string)  The URL needed to download the latest version of the theme (mandatory).

infourl

(string)  The URL used to display the information (changelog) about the changes brought with the latest version of the theme (optional).


Parameters

$themes

(array)  A list of subscribers. Each element of the array should be an associative array specifying the information previously described.


Example

The example below explains how to subscribe a custom theme to VikUpdater.

function your_theme_vikupdater_subscribe( $subscribers ) {
    $subscribers[] = [
        // replace with the real name of your theme
        'name' => 'Your Theme Name',
        // replace with the id of your theme, which is usually equal to
        // the name of the theme folder (required)
        'theme' => 'your-theme',
        // replace with the current version of your theme (required)
        'version' => '1.0',
        // the minimum required version of WordPress (optional)
        'requires' => '4.0',
        // the minimum required version of your PHP (optional)
        'requires_php' => '7.4',
        // the URL used to fetch the manifest of your theme (required)
        'url' => 'https://your-theme-url.com/api/version',
        // the URL used to download the latest version of the theme
        'download' => 'https://your-theme-url.com/api/latest',
        // the URL used to display the changelog of the theme
        'infourl' => 'https://your-theme-url.com/api/changelog',
    ];

    return $subscribers;
}

add_filter( 'vikupdater_subscribe_themes', 'your_theme_vikupdater_subscribe' );

Changelog

Version Description
2.0 Introduced.
Last Update: 2023-11-20
Helpful?