Skip to content

Instantly share code, notes, and snippets.

View Programmer095's full-sized avatar

Cory Hyland Programmer095

  • Earth
View GitHub Profile
@Programmer095
Programmer095 / recalculate-acf-locations.php
Created July 7, 2023 01:15 — forked from renshuki/recalculate-acf-locations.php
Update ACF location fields (Google Map) after WP All Import CSV import (Google map update not triggered correctly) - Credits: https://support.advancedcustomfields.com/forums/topic/how-to-update-google-map-latitudelongitude-after-importing-using-address/
<?php
global $ld_recalc;
global $geolocate_api_key;
$geolocate_api_key = "YOUR_GOOGLE_GEOLOCATE_API_KEY";
$ld_recalc = array(
'posts_per_run' => 16,
'post_types' => array( 'distributor' ),
@Programmer095
Programmer095 / jenkins_wpsvn_deploy.sh
Created August 30, 2022 18:35 — forked from elvismdev/jenkins_wpsvn_deploy.sh
Deploy from Jenkins to WordPress.org SVN
# In your Jenkins job configuration, select "Add build step > Execute shell", and paste this script contents.
# Replace `______your-plugin-name______`, `______your-wp-username______` and `______your-wp-password______` as needed.
# main config
WP_ORG_USER="______your-wp-username______" # your WordPress.org username
WP_ORG_PASS="______your-wp-password______" # your WordPress.org password
PLUGINSLUG="______your-plugin-name______"
CURRENTDIR=`pwd`
MAINFILE="______your-plugin-name______.php" # this should be the name of your main php file in the wordpress plugin
@Programmer095
Programmer095 / convert_array_access_braces.php
Created June 21, 2021 10:06 — forked from theodorejb/convert_array_access_braces.php
Migrate deprecated curly brace array access syntax to bracket syntax. Requires PHP 7.4.
<?php
error_reporting(E_ALL);
$opts = getopt('f:d:rb:', ['ext:', 'php:', 'diff::']);
if ((int)isset($opts['d']) + (int)isset($opts['f']) !== 1) {
$self = basename(__FILE__);
echo <<<EOF
Usage:
php $self -f<php_script> [-b] [--php <path_to_php>] [ --diff [<file>]]
@Programmer095
Programmer095 / Import Types.md
Created April 27, 2021 11:07 — forked from mbissett/Import Types.md
WP All Import - Import Types

A description of import types

  • New Items Import -

This is primarily used to create and manage products. It keeps internal track of the products that it imports, which means that it can later update/create/delete products as they're changed/added/removed in your import file. It's also the only import type that can add/remove variations for variable products.

One limitation of new items imports is that cannot detect/update products that it didn't previously create. If you need to use a "New Items" import with a file that contains existing products, you can use WP All Import's API to prevent duplicates from being imported: https://www.wpallimport.com/documentation/developers/code-snippets/#do-not-create-products-with-duplicate-sku.

@Programmer095
Programmer095 / Import Types.md
Created January 16, 2020 04:04 — forked from trey8611/Import Types.md
WP All Import - Import Types

A description of import types

  • New Items Import -

This is primarily used to create and manage products. It keeps internal track of the products that it imports, which means that it can later update/create/delete products as they're changed/added/removed in your import file. It's also the only import type that can add/remove variations for variable products.

One limitation of new items imports is that cannot detect/update products that it didn't previously create.

@Programmer095
Programmer095 / futta-gutenprint.php
Created November 15, 2018 23:11 — forked from 2aces/futta-gutenprint.php
Frank Goossens (Futta) function to extract blocks from WP Gutenberg (Proof of Concept) as https://blog.futtta.be/2018/01/25/how-to-extract-blocks-from-gutenberg/
// proof-of-concept to extract all WordPress Gutenberg's blocks as array
// author: Frank Goossens (Futta)
// source: https://blog.futtta.be/2018/01/25/how-to-extract-blocks-from-gutenberg/
add_action('the_content','gutenprint',10,1);
function gutenprint($html) {
// check if we need to and can load the Gutenberg PEG parser
if ( !class_exists("Gutenberg_PEG_Parser") && file_exists(WP_PLUGIN_DIR."/gutenberg/lib/load.php") ) {
include_once(WP_PLUGIN_DIR."/gutenberg/lib/load.php");
}
add_filter('wp_all_import_set_post_terms', 'wpai_wp_all_import_set_post_terms', 10, 4);
function wpai_wp_all_import_set_post_terms($assign_terms, $tx_name, $pid, $import_id) {
	if ($tx_name == 'product_cat'){		
		$post = get_post($pid);
		if ($post->post_type == 'product_variation') {
			$parentID = $post->post_parent;				
			$term_ids = wp_get_object_terms($parentID, $tx_name, array( 'fields' => 'ids' ));							
 if (!empty($assign_terms)) {
@Programmer095
Programmer095 / gist:e1a024cbe729c780bad99d52af1f19d0
Created August 12, 2018 21:37 — forked from gonzopancho/gist:760ab9ecee9dfbc1b6033e48647a4b48
pfSense software 2.4.3 on espresso.bin (now booting from SD card)
NOTICE: Booting Trusted Firmware
NOTICE: BL1: v1.3(debug):armada-17.06.2:297d68f
NOTICE: BL1: Built : 11:01:44, Jan 9 2NOTICE: BL2: v1.3(debug):armada-17.06.2:297d68f
NOTICE: BL2: Built : 11:01:47, Jan 9 2018NOTICE: BL31: v1.3(debug):armada-17.06.2:297d68f
NOTICE: BL31:
U-Boot 2017.03-armada-17.06.3-ga33ecb8-dirty (Jan 09 2018 - 10:56:45 -0200)
Model: Marvell Armada 3720 Community Board ESPRESSOBin
CPU @ 1000 [MHz]
<?php
/*
################### READ ME #################################
You'll pass the URL to your feed/file to this function inside the "Download from URL" option when creating an import. Examples:
1. [custom_file_download("ftp://username:password@hostname.com/full/path/to/file.csv", "csv")]
2. [custom_file_download("http://example.com/full/path/to/file.csv", "csv")]
You must add the code for the function inside your themes functions.php file, or in a plugin like Code Snippets.
@Programmer095
Programmer095 / wp-login-with-sha1-password.php
Created June 7, 2018 18:38 — forked from maxrice/wp-login-with-sha1-password.php
Allow wordpress login with sha1 password hash in database
<?php
// check if hashed password is SHA1 and update as necessary, see function comments
add_filter( 'check_password', 'check_sha1_password', 10, 4 );
/**
* Check if a user has a SHA1 password hash, allows login if password hashes match, then updates password hash to wp format
*
* Hooks into check_password filter, mostly copied from md5 upgrade function with pluggable.php/wp_check_password
*
* @param string $check