Skip to content

Instantly share code, notes, and snippets.

View norcross's full-sized avatar

Norcross norcross

View GitHub Profile
@norcross
norcross / admin-notice-class.php
Created July 27, 2017 15:45 — forked from monkeymonk/Notice.php
WordPress Admin Notice Helper Class
<?php
/**
* Helper to work with Wordpress admin notices
*
* @example
* Notice::success('All is good!');
*
* @example
* Notice::warning('Do something please.', true);
@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 / .htaccess
Last active August 29, 2015 14:07 — forked from ScottPhillips/.htaccess
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@norcross
norcross / 0_reuse_code.js
Created August 1, 2014 14:27
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@norcross
norcross / widget.php
Last active August 29, 2015 14:02 — forked from joelgoodman/widget.php
<?php
/**
* ITS Related Links
*
* The WordPress Widget Boilerplate is an organized, maintainable boilerplate for building widgets using WordPress best practices.
*
*/
class ITS_Contact_Box extends WP_Widget {
@norcross
norcross / chilpages-looping.php
Last active September 5, 2024 01:40 — forked from crondeau/chilpages-looping.php
modified version of child loops
<?php
function rkv_child_pages( $this_page ) {
$args = array(
'fields' => 'ids',
'post_type' => 'work',
'post_parent' => $this_page,
'nopaging' => true,
'orderby' => 'menu_order'
@norcross
norcross / Image-Waterfall.php
Created July 7, 2012 04:32 — forked from eddiemachado-zz/Image-Waterfall.php
images with fallbacks
// let's go through and get the right image
function dg_thumb_waterfall() {
global $post;
if ( has_post_thumbnail($post->ID) ) {
echo '<div class="thumbnail-wrapper">';
the_post_thumbnail('digi-med-thumb');
echo '</div>';