Skip to content

Instantly share code, notes, and snippets.

Ken Prince kjprince

Block or report user

Report or block kjprince

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kjprince
kjprince / Wordpress Nginx Config
Last active Nov 3, 2018
/etc/nginx/wordpress.conf
View Wordpress Nginx Config
##################################
# WORDPRESS NGINX CONFIGURATIONS
##################################
# /etc/nginx/wordpress.conf
#
# Contains a common configuration for use by nginx on a WordPress
# installation. This file should be included in any WordPress site
# nginx virtual host config located in sites-available with the following line:
#
# include /etc/nginx/wordpress.config;
@kjprince
kjprince / alternative nginx.conf
Last active Jul 27, 2018
/etc/nginx/nginx.conf
View alternative nginx.conf
# See this setup: http://polihronov.wordpress.com/
#
#
user www-data;
worker_processes 1;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
# multi_accept on;
View keybase.md

Keybase proof

I hereby claim:

  • I am kjprince on github.
  • I am kjprince (https://keybase.io/kjprince) on keybase.
  • I have a public key ASByjDRiL9ZAjpCrE-sddgUcvOeYwmA4d3rWrWpVj5N2eQo

To claim this, I am signing this object:

@kjprince
kjprince / delete-all-woocommerce-products.php
Created Jul 13, 2017 — forked from mikaelz/delete-all-woocommerce-products.php
Remove all WooCommerce products from database via SQL
View delete-all-woocommerce-products.php
<?php
require dirname(__FILE__).'/wp-blog-header.php';
$wpdb->query("DELETE FROM wp_terms WHERE term_id IN (SELECT term_id FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%')");
$wpdb->query("DELETE FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%'");
$wpdb->query("DELETE FROM wp_term_relationships WHERE term_taxonomy_id not IN (SELECT term_taxonomy_id FROM wp_term_taxonomy)");
$wpdb->query("DELETE FROM wp_term_relationships WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'))");
$wpdb->query("DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'))");
$wpdb->query("DELETE FROM wp_posts WHERE post_type IN ('product','product_variation')");
@kjprince
kjprince / delete-all-woocommerce-products.php
Created Jul 13, 2017 — forked from mikaelz/delete-all-woocommerce-products.php
Remove all WooCommerce products from database via SQL
View delete-all-woocommerce-products.php
<?php
require dirname(__FILE__).'/wp-blog-header.php';
$wpdb->query("DELETE FROM wp_terms WHERE term_id IN (SELECT term_id FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%')");
$wpdb->query("DELETE FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%'");
$wpdb->query("DELETE FROM wp_term_relationships WHERE term_taxonomy_id not IN (SELECT term_taxonomy_id FROM wp_term_taxonomy)");
$wpdb->query("DELETE FROM wp_term_relationships WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'))");
$wpdb->query("DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'))");
$wpdb->query("DELETE FROM wp_posts WHERE post_type IN ('product','product_variation')");
@kjprince
kjprince / NGINX Virtual Host
Created Mar 15, 2014
/etc/nginx/sites-available/mysite.com
View NGINX Virtual Host
# Virtual Host File
# Common wordpress configurations included in /etc/nginx/wordpress.conf
# All virtual hosts including this one are symlinked to /etc/nginx/sites-enabled
# Make sure you replace "mysite" with your domain name
server {
listen 80 default_server;
listen 443 ssl;
server_name mysite.com www.mysite.com *.mysite.com;
@kjprince
kjprince / Google Analytics Content Experiments code for Google Tag Manager With this script you are good to go for client-site A/B/n testing with Content Experiments. Add ?var=1 to preview the variation of the A/B test.
View Google Analytics Content Experiments code for Google Tag Manager
<script src="//www.google-analytics.com/cx/api.js?experiment=YOUR_EXPERIMENT_ID"></script>
<script>
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
var varID = getParameterByName('var');
if(! varID){ var chosenVariation = cxApi.chooseVariation(); }
@kjprince
kjprince / wp-bootstrap-grid
Created Jun 19, 2015
3 Column Bootstrap Layout WP Posts
View wp-bootstrap-grid
<div class="container my-container">
<?php
$args=array(
'post_type' => 'reviews',
'post_status' => 'publish',
'posts_per_page' => 18
);
$my_query = null;
View gist:bad14742fd6fa0f82eec
Verifying that +kjprince is my openname (Bitcoin username). https://onename.com/kjprince
View gist:44ba9fc36de13560454f
<p>This is a test to see if this strategy will work.</p>
<p>I'm going to see if I can add some inline links.</p>
<p><a href="http://princeagency.com" title="Hopewell Junction Insurance Agent" rel="follow">Hopewell Junction New York</a></p>
You can’t perform that action at this time.