Skip to content

Instantly share code, notes, and snippets.

View jkudish's full-sized avatar

Joey Kudish jkudish

View GitHub Profile
@jkudish
jkudish / edd-bug.php
Created November 28, 2023 03:26
Minimum code to reproduce a bug in EDD's database query when performing an Order query containing a date_query and a product_id at the same time
<?php
/**
* Plugin Name: Edd Database Bug Reproduction
* Plugin URI:
* Description: Reproduce a bug in EDD's database query.
* Author: Joey Kudish
* Author URI: https://github.com/jkudish
* Text Domain: edd-database-bug
* Domain Path: /languages
* Version: 0.1.0
@jkudish
jkudish / dusk.sh
Created March 28, 2017 17:45
How I run dusk on Codeship
export DUSK_START_CHROMEDRIVER=false
export DUSK_APP_PORT=8000
export DUSK_CHROME_BINARY=/usr/bin/chromium-browser
nohup bash -c "./vendor/laravel/dusk/bin/chromedriver-linux 2>&1 &"
nohup bash -c "php artisan serve --env=dusk.testing 2>&1 &" && sleep 4
php artisan dusk
<?php
require_once dirname( __FILE__ ) . '/wp-load.php';
//$existing_image = 'http://guidevoyage.org.dev' . '/wp-content/uploads/2010/12/122010_0314_LamdinadeSo1.png';
//Locate the attachment post's ID in the database based on the GUID.
function getIDfromGUID( $full_image_url ){
global $wpdb;
<?php
//Locate the attachment post's ID in the database based on the GUID.
function getIDfromGUID( $existing_image ){
global $wpdb;
return $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type=attachment AND guid=%s", $existing_image ) );
}
$existing_image = "http://guidevoyage.org.dev/wp-content/uploads/2012/02/Fontaine-de-Trevi.jpg";
@jkudish
jkudish / displaylink-installer-.sh
Created August 13, 2015 04:56
displaylink-installer.sh modified for Fedora 22
@jkudish
jkudish / gist:6498978
Created September 9, 2013 17:42
Flynn's Site Redesign
<!DOCTYPE html>
<html>
<head>
<title>Flynn O'connor - Ginger Magic</title>
</head>
<body>
<img src="http://images.bluegartr.com/bucket/gallery/b2cd73a5be2f61e788add2d3cb6e8839.jpg" alt="Ginger Magic">
</body>
</html>
<?php
/**
* Notes and things that I changed:
* -- fixed indentation and spacing for WP standards
* -- posts_per_page = -1 is dangerous, what happens if the site has 1000000 posts, the server will explode - find a high but sane limit
*/
// loop through the sub-pages of your custom post type
$childpages = new WP_Query( array(
I searched for the following
<dc:creator><![CDATA[:)]]></dc:creator>
and replaced with the following:
<dc:creator><![CDATA[mymoltenshield]]></dc:creator>
@jkudish
jkudish / singleton-example.php
Last active December 16, 2015 11:58
This is an example of a singleton
<?php
My_Class {
private static $instance;
public static function instance() {
if ( isset( self::$instance ) )
return self::$instance;
Index: wp-admin/nav-menus.php
===================================================================
--- wp-admin/nav-menus.php (revision 23446)
+++ wp-admin/nav-menus.php (working copy)
@@ -264,6 +264,8 @@
// Get existing menu locations assignments
$locations = get_registered_nav_menus();
$menu_locations = get_nav_menu_locations();
+ if ( empty( $menu_locations ) || ! is_array( $menu_locations ) )
+ $menu_locations = array();