Skip to content

Instantly share code, notes, and snippets.

View greenhornet79's full-sized avatar
👽
Craft

Jeremy Green greenhornet79

👽
Craft
View GitHub Profile
@greenhornet79
greenhornet79 / SassMeister-input.scss
Created August 7, 2014 14:13
Generated by SassMeister.com.
// ----
// Sass (v3.3.14)
// Compass (v1.0.0.rc.1)
// ----
.nav {
width: 100%;
ul {
background: #ddd;
li {
@greenhornet79
greenhornet79 / SassMeister-input.scss
Created August 7, 2014 14:18
Generated by SassMeister.com.
// ----
// Sass (v3.3.14)
// Compass (v1.0.0.rc.1)
// ----
$green: #063C22;
a {
color: $green;
}
@greenhornet79
greenhornet79 / SassMeister-input.scss
Created August 7, 2014 14:21
Generated by SassMeister.com.
// ----
// Sass (v3.3.14)
// Compass (v1.0.0.rc.1)
// ----
@mixin border-radius($radius) {
-webkit-border-radius: $radius;
-moz-border-radius: $radius;
-ms-border-radius: $radius;
border-radius: $radius;
@greenhornet79
greenhornet79 / gist:bd82492924be251dca1c
Created September 2, 2014 19:22
Create custom database table on WordPress plugin activation
register_activation_hook( __FILE__, 'endo_create_custom_table' );
function endo_create_custom_table() {
global $wpdb;
$table_name = $wpdb->prefix . "custom_table";
$sql = "CREATE TABLE $table_name(
id mediumint(9) NOT NULL AUTO_INCREMENT,
@greenhornet79
greenhornet79 / gist:ae96902641a2846a166e
Created September 24, 2014 18:22
Create 3 columns with the byBrick columns shortcode
[one_third]<img src="http://localhost:8888/dev/wp-content/uploads/2014/09/40-fort-1-300x240.png" alt="40-fort-1" width="300" height="240" class="alignnone size-medium wp-image-1425" />
<h3>40 In the Fort</h3>
A 40 mile mountain bike race in Fort Collins, CO.[/one_third]
[one_third]<img src="http://localhost:8888/dev/wp-content/uploads/2014/09/rrrr-300x300.jpg" alt="rrrr" width="300" height="300" class="alignnone size-medium wp-image-1428" />
<h3>Red River Roadkill Rally</h3>
A 60 mile road bike tour in Ardmore, OK.[/one_third]
[one_third_last]<img src="http://localhost:8888/dev/wp-content/uploads/2014/09/denver-century-team-young-life-300x267.jpg" alt="denver-century-team-young-life" width="300" height="267" class="alignnone size-medium wp-image-1426" />
<h3>Denver Century</h3>
@greenhornet79
greenhornet79 / gist:972f40460d04703f5408
Created October 6, 2014 17:10
Add IssueM articles to an author's archive page
<?php
function issuem_post_author_archive( &$query )
{
if ( $query->is_author )
$query->set( 'post_type', 'article' );
remove_action( 'pre_get_posts', 'issuem_post_author_archive' ); // run once!
}
add_action( 'pre_get_posts', 'issuem_post_author_archive' );
@greenhornet79
greenhornet79 / gist:0a5e200694b36a817121
Created January 23, 2015 00:55
WP Database URL Search and Replace
UPDATE wp_options SET option_value = replace(option_value, 'http://devsite.com', 'http://livesite.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://devsite.com','http://livesite.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://devsite.com', 'http://livesite.com');
@greenhornet79
greenhornet79 / gist:947276fe0198046c8b57
Created February 6, 2015 21:14
Hide WordPress admin from subscribers
// remove admin bar from free users
add_action('after_setup_theme', 'remove_admin_bar');
function remove_admin_bar() {
if (!current_user_can('administrator') && !is_admin()) {
show_admin_bar(false);
}
}
// don't allow users to access WordPress admin
add_action('admin_init', 'no_mo_dashboard');
@greenhornet79
greenhornet79 / gist:f9284b63a942f0b1f318
Created March 2, 2015 03:52
Gravity Forms - change state names to abbreviations
add_filter("gform_address_types", "us_address", 10, 2);
function us_address($address_types, $form_id){
$address_types["us"] = array(
"label" => "United States",
"country" => "USAB",
"zip_label" => "Zip Code",
"state_label" => "State",
"states" => array(
"" => "",
"AL" => "Alabama",
@greenhornet79
greenhornet79 / issue-to-pdf-watermark.php
Last active September 4, 2015 13:28
Add watermark to Issue to PDF pages
<?php
add_action( 'issue_to_pdf_after_pdf_init', 'my_func_show_watermark', 10 );
function my_func_show_watermark( $mpdf ) {
$mpdf->SetWatermarkText('DRAFT');
$mpdf->showWatermarkText = true;
}