Skip to content

Instantly share code, notes, and snippets.

View ccurtin's full-sized avatar
🤙
makka thangs

Christopher James Curtin ccurtin

🤙
makka thangs
View GitHub Profile
@ccurtin
ccurtin / wordpress-custom-excerpt-length-function.md
Last active October 7, 2016 18:03
Wordpress: Custom Excerpt Length Function

A couple ways to disaply an excerpt based on word length

  • method 1 uses "get_the_excerpt()"
  • method 2 uses "get_the_content()"
@ccurtin
ccurtin / Wordpress:Generate-Unique-Widgets.php
Last active October 7, 2016 18:03
Wordpress: Generate Unique Widget for All/Any Pages/Posts
<?php
/**
* Registers a unique widget for each individual page
* @author christopher james curtin <git@christopherjamescurtin.com>
*/
//If dynamic sidebar exists
if (function_exists('register_sidebar')) {
$pages = get_pages( // First, retreive all pages that exist.
array (
'parent' => 0, // replaces 'depth' => 1
@ccurtin
ccurtin / :Wordpress: :Plugins: :Newsletters: simple-form-setup.html
Last active October 7, 2016 18:03
:Wordpress: :Plugins: :Newsletters: simple form setup
<script type="text/javascript">
//<![CDATA[
if (typeof newsletter_check !== "function") {
window.newsletter_check = function (f) {
var re = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-]{1,})+\.)+([a-zA-Z0-9]{2,})+$/;
if (!re.test(f.elements["ne"].value)) {
alert("Please Enter a valid email");
return false;
}
if (f.elements["nn"] && (f.elements["nn"].value == "" || f.elements["nn"].value == f.elements["nn"].defaultValue)) {
//■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
/*
Plugins
*/
//■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
var gulp = require('gulp'),
shell = require('gulp-shell'),
compass = require('gulp-compass'),
gutil = require('gulp-util'),
@ccurtin
ccurtin / Preferences.sublime-settings
Created November 17, 2014 03:31
:SUBLIME: :SETTINGS: exclude files and folders from search
{
"file_exclude_patterns":
[
"*.sass-cache",
"*.pyo",
"*.exe",
"*.dll",
"*.obj",
"*.o",
"*.a",
@ccurtin
ccurtin / :WORDPRESS: using-PHP-variables-in-JS.md
Last active December 3, 2022 07:28
:WORDPRESS: using-PHP-variables-in-JS (wp localize script)
@ccurtin
ccurtin / pre-functions.php
Created November 20, 2014 07:24
auto-enqueue-scripts
<?php
//*** FOLLOWING CODE GETS the ENTERED URL from the BROWSER AND MAPS it to CORRECT ROUTER and CHANGES ALL INSTANCES in the PAGES *** //
// Gets URL part "subdomain.domain.com:8081"
// Don't forget to add the sub-directory location!
$wp_ubiquitousDomain = "http://" . $_SERVER['HTTP_HOST'] . "/smith/asb/wordpress/";
update_option( 'siteurl', $wp_ubiquitousDomain);
update_option( 'home', $wp_ubiquitousDomain );
@ccurtin
ccurtin / xcopy-robocopy.md
Last active August 29, 2015 14:10
COPY source->destination
XCOPY X:\path\source\*.* X:\path\to\destination /D/S/H/V/C/F/K/Y
robocopy ./path/to/src/ ./path/to/dest/ -E

Robocopy Syntax

ROBOCOPY source destination [file [file]…] [options]

@ccurtin
ccurtin / :PAYPAL: sample-discount-quantity-checkout
Created November 21, 2014 23:35
:PAYPAL: sample-discount-quantity-checkout
https://www.sandbox.paypal.com/cgi-bin/webscr?business=info@hairubuild.com&cmd=_xclick&amount=10&shipping=0&discount_num=10&discount_rate=10&discount_rate2=10&quantity=10
@ccurtin
ccurtin / wspsc-cart-functions.php
Last active October 7, 2016 18:02
wspsc-cart-functions
<?php
function print_wp_shopping_cart($args = array()) {
$output = "";
if (!cart_not_empty()) {
$empty_cart_text = get_option('wp_cart_empty_text');
if (!empty($empty_cart_text)) {
$output .= '<div class="wp_cart_empty_cart_section">';
if (preg_match("/http/", $empty_cart_text)) {
$output .= '<img src="' . $empty_cart_text . '" alt="' . $empty_cart_text . '" class="wp_cart_empty_cart_image" />';