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 / agile store locator fix for conflict with wp all import.md
Created June 5, 2019 19:28
Agile Store Locator Fix for Conflict with WP All Import

The code below goes in something like https://wordpress.org/plugins/code-snippets/ or your theme's functions.php file:

function soflyy_dequeue_agile_locator_script() { 
  if(class_exists ('AgileStoreLocator')){ 
    $core = new AgileStoreLocator(); 
    $name = $core->get_AgileStoreLocator() . '-lib'; 
    wp_dequeue_script( $name ); 
    }}
 
@Programmer095
Programmer095 / Import myCRED Points to users with WP All Import.md
Last active February 28, 2022 17:59
Import myCRED Points to users with WP All Import

This code and procedure are provided in the hope that they're useful, but without support and without any warranty expressed or implied

The code below needs to go in something like https://wordpress.org/plugins/code-snippets/ or your theme's functions.php file ( example code, adjust if needed ):

add_filter( 'mycred_setup_hooks', 'mycredpro_adjust_hooks', 10, 2 );
function mycredpro_adjust_hooks( $installed, $point_type ) {

	// Add a custom hook
@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]