wptriangle / deploy-netlifypress Goto Github PK
View Code? Open in Web Editor NEWSeamlessly trigger deploys in Netlify from WordPress.
License: GNU General Public License v2.0
Seamlessly trigger deploys in Netlify from WordPress.
License: GNU General Public License v2.0
Hey !
I'm currently using NetlifyPress on all my WordPress Headless and I quickly realized a problem with the editors of WordPress.
Since they are only editors, and therefore do not have access to the Netlify space, they do not know the build status of Netlify.
The idea here would be to have a metabox or some space within the Dashboard with the Netlify status badge.
This would allow to have an overview for the editors and thus avoid having a feedback or having a "spam" on the trigger button.
Another suggestion at the manual build level would be to have a metabox like "There are x unpublished changes", indicating to the user that he has not used the trigger for a while.
Thanks !
Hi @nfmohit
While working on a similar plugin, but for Buddy.works integration I was trying to tackle the problem related to auto-deployment and while looking at your code I saw one bug.
if ( 'auto-draft' == get_post_status( $post_id ) || 'draft' == get_post_status( $post_id ) || wp_is_post_revision( $post_id ) ) {
return;
}
So if we will unpublish the post/page it won't run and I think it should as unpublishing changes the content of the page.
I used a bit different approach. First of all I used transition_post_status
action and then I went for something like this:
function check_post_status( $new_status, $old_status, $post ) {
if ( 'auto-draft' === $post->post_status || wp_is_post_revision( $post->ID ) ) {
return false;
}
// publishing or updating something
if ( 'publish' === $new_status ) {
return true;
}
// unpublishing
if ( 'publish' !== $new_status && 'publish' === $old_status ) {
return true;
}
return false;
}
Of course your functionality is a bit different, but I hope you get the point.
Hello @nfmohit-wpmudev! Big fan of this plugin, it works wonderfully.
I currently use a couple of WordPress deployments that are mostly updated by authors using the WordPress iOS app. In my testing, it seems like publishing or updating a post from the mobile app does not currently take any advantage of this plugin.
I'm curious โย I thought there were global sort-of WordPress "hooks" that can be listened to. If these global hooks exist, is this how this plugin works? Is using a "post-published" hook on the WordPress install, triggered by a publish from the app, anywhere in the realm of possibility?
I think that those syntax improvement can be add.
main.js :
(begin of the script)
( function( $ ) { $( document ).ready( function() {
to
( $ => { $(function() {
Because here you have one param (therefore you dont need () ) and you don't use "this" in the first fonction thus you can use a arrow func.
Then next you have the shortcut of ready, like you can see in this documentation : https://learn.jquery.com/using-jquery-core/document-ready/
I can see in some files that you used :
<?php echo "something" ?>
but you can use in this case directly :
<?= "something" ?>
its a shortcut.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.