Skip to content

Instantly share code, notes, and snippets.

View norcross's full-sized avatar
somone said this would be easy. someone LIED.

Norcross norcross

somone said this would be easy. someone LIED.
View GitHub Profile
@norcross
norcross / csv-export-example.php
Created August 9, 2015 20:14
a basic CSV export example
<?php
/**
* Devin CSV Export
*
* Contains our export processing
*/
/*
Copyright 2015 Reaktiv Studios
This program is free software; you can redistribute it and/or modify
@norcross
norcross / country-array.php
Last active January 24, 2020 15:43 — forked from DHS/PHP Countries Array
PHP array of all country names
<?php
$countries = array(
'Afghanistan',
'Albania',
'Algeria',
'American Samoa',
'Andorra',
'Angola',
'Anguilla',
<?php
/**
* keeps a user always logged in
* don't use this on a production site, ever!
*/
add_action( 'init', 'rkv_auto_login' );
add_action( 'admin_init', 'rkv_auto_login' );
@norcross
norcross / shortcode-clean.php
Created April 27, 2015 16:58
remove some weird tags on shortcodes
<?php
add_filter( 'the_content', 'rkv_shortcode_cleanup',1001 );
/**
* remove weird tags
*
* @param [type] $content [description]
*/
function rkv_shortcode_cleanup( $content ) {
@norcross
norcross / rkv-bypass-auto-update.php
Created February 19, 2015 01:21
prevent WordPress from sending emails when the auto update is successful
<?php
/**
* bypass the notification email on successful auto-updates
*
* @param [type] $send [description]
* @param [type] $type [description]
* @param [type] $core_update [description]
* @param [type] $result [description]
* @return [type] [description]
*/
@norcross
norcross / force-image-https.php
Created January 21, 2015 02:08
filter content to rewrite image src to https
<?php
add_filter( 'the_content', 'rkv_force_https_images', 10 );
/**
* check image URLs and force https on them
*
* @param [type] $content [description]
*/
function rkv_force_https_images( $content ) {
return str_replace( 'src="http://css-tricks.com', 'src="https://css-tricks.com', $content );
@norcross
norcross / cun-notify-single.php
Created January 20, 2015 14:53
filter the content notification to a single post ID
<?php
add_filter( 'cun_single_item_email', 'rkv_single_cun_notify' );
function rkv_single_cun_notify( $post_id ) {
return absint( $post_id ) === absint( THE_ID_I_WANT ) ? true : false;
}
@norcross
norcross / wp-comment-noreply-meta.php
Created November 25, 2014 03:38
remove the noindex meta tag from single reply comment links
<?php
add_action( 'init', 'rkv_comment_noindex_base' );
/**
* remove the noindex flag on the reply links
* when not using Yoast SEO
*
* @return null
*/
function rkv_comment_noindex_base() {
@norcross
norcross / remove-month-dropdown.php
Created November 5, 2014 03:48
remove the month drop down from post types
<?php
add_filter( 'months_dropdown_results', 'rkv_remove_month_filters' ), 10, 2 );
/**
* remove the month drop down filter by
* spoofing WP and saying that none exist
* for specific post types
*
* @param array $months the original count
* @param string $post_type the post type
@norcross
norcross / on-click-example.js
Created October 20, 2014 16:51
example of using on.click with dynamic elements
// the idea being that the container div exists outside of the
// dynamic element, and the anchor link is loaded.
jQuery( 'div.container' ).on( 'click', 'a.dynamic-element' function (){
// do your thing here
});