This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal | |
set install_name=bigdaddylocal | |
set theme_folder=fivebyfive | |
REM Set variables | |
set remote_base_dir=/sites/%install_name%/wp-content/themes/%theme_folder%/ | |
set ssh_host=%install_name%@%install_name%.ssh.wpengine.net |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('wp_ajax_ACTION_HERE', function(){ | |
$response = [ | |
'post' => $_POST, | |
]; | |
wp_send_json($response); | |
}); | |
?> | |
<script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function script_ready_check(script, cb, interval, limit){ | |
var time = 0; | |
var check = setInterval(function(){ | |
if( typeof script !== 'undefined' ) { | |
clearInterval(check); | |
cb(); | |
} | |
time += interval; | |
if( time >= limit ) { | |
clearInterval(check); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function group_items(items, items_per_group){ | |
var groups = [ | |
[], | |
]; | |
var current_group = 0; | |
var group_items_count = 0; | |
for( var i = 0; i < items.length; i++ ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace FF\Vite; | |
function get_manifest(){ | |
$manifest_file = __DIR__ . '/dist/.vite/manifest.json'; | |
$manifest = wp_json_file_decode( $manifest_file ); | |
return $manifest; | |
} | |
function get_mode(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('wp_head', 'load_critical_css', 0); | |
function load_critical_css(){ | |
$dir = FF_DIR .'/dist'; | |
$handle = 'src/critical.js'; | |
$manifest = FF\Vite\get_manifest($dir); | |
if( !$manifest ) return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
!.gitignore | |
**/.DS_Store | |
**.log | |
gitignore/ | |
!wp-content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Upload_File { | |
function upload_file( $file_url ) { | |
$path_info = pathinfo($file_url); | |
$file_name = $path_info['filename']; | |
$attachment_id = $this->get_attachment_id_by_filename($file_name); | |
if( !$attachment_id ) { | |
// does not exist yet, upload |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function get_plugin_version($file){ | |
$file_content = file_get_contents($file); | |
$tokens = token_get_all( $file_content ); | |
$comment = array( | |
T_COMMENT, | |
T_DOC_COMMENT, | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$attachments = get_posts( array( | |
'post_type' => 'attachment', | |
'posts_per_page' => -1, | |
'post_parent' => $id, | |
) ); | |
$images = []; | |
foreach( $attachments as $attachment ) { | |
$images[] = $attachment->guid; | |
} |
NewerOlder