Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

WordPress themes are typically submitted to the review team to be hosted and published on the WordPress Theme Directory. We are working on an internal theme that will not work outside of our use case. It is also developed and managed using git and hosted on our Digital Ocean droplet.
How can we use our self-hosted, git-managed WordPress theme and have it behave like a normal theme would? For example, WordPress detects when the theme needs to be updated and the theme is auto-updated. If auto-updating is disabled, then it should wait till the update link is clicked manually.
I have begun with creating a --bare repo on our droplet with ssh authentication. I have also attempted to create a php class in the theme that cross checks the active theme’s version with the git repo but have unsuccessful in doing so. I did find some articles that have some good info but always ends up using a service or plugin to handle the pushing. If at all possible, we would like to accomplish this without 3rd party services or plugins.
I have broken out what I think needs to happen in the following steps:
I was able to get the current theme version by using wp_get_theme() and then retrieving the version property. I am hoping to use the same function to check the theme on in the git repo but I hit a wall trying to retrieve the git repo. I am not sure how to retrieve the git repo, and once it is retrieved, how would I decode it from the bare git data. Also to clarify, we are not using Github or any other service to manage our git repo. Our WordPress install is currently setup on my local environment (wp-env) as I have not yet deployed it to a server. We are planning on deploying it on a FreeBSD distribution with Nginx.
<?php
class Dnk_Webos_Version_Check {
protected $file;
protected $theme;
protected $version;
public function __construct( $file ) {
$this->file = $file;
$this->theme = wp_get_theme();
$this->version = $this->theme->version;
// Debug test
add_action( 'admin_notices', array( $this, 'debug_notice' ) );
}
public function debug_notice() {
$debug = esc_html( $this->theme );
?>
<div class="notice notice-success is-dismissible">
<p><?php echo $this->version; ?></p>
</div>
<?php
}
}
?>
Local Environment WordPress 5.8 PHP 7.4.21 Apache/2.4.38 (Debian) Linux 5.10.25-linuxkit x86_64
Git Server FreeBSD 12.2 zfs x64
RentCrown Dubai
Peter Alison
Magpie Tours
Mark Vicente
orbitstorm88
rem3n
1ddffddc31ea402a842dcb134f6134
Iain Warde
michalakis
Briljent IT
Charley Kiser