PHP code example of inc2734 / wp-github-theme-updater

1. Go to this page and download the library: Download inc2734/wp-github-theme-updater library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

inc2734 / wp-github-theme-updater example snippets



$updater = new Inc2734\WP_GitHub_Theme_Updater\Bootstrap(
  get_template(),
  'user-name',
  'repository'
);

add_filter(
  'inc2734_github_theme_updater_request_url_inc2734/snow-monkey',
  function( $url, $user_name, $repository ) {
    return $url;
  },
  10,
  3
);

add_filter(
  'inc2734_github_theme_updater_transient_response_inc2734/snow-monkey',
  function( $transient_response ) {
    return $transient_response;
  }
);

add_filter(
  'inc2734_github_theme_updater_repository_content_url_inc2734/snow-monkey',
  function( $url, $user_name, $repository, $theme_name ) {
    return $url;
  },
  10,
  4
);

add_filter(
  'inc2734_github_theme_updater_repository_content_headers_inc2734/snow-monkey',
  function( $headers ) {
    return $headers;
  }
);

add_filter(
  'inc2734_github_theme_updater_request_url',
  function( $url, $user_name, $repository ) {
    if ( 'inc2734' === $user_name && 'snow-monkey' === $repository ) {
      return 'https://example.com/my-custom-updater-request-url';
    }
    return $url;
  },
  10,
  3
);