Skip to content

Instantly share code, notes, and snippets.

Avatar
somone said this would be easy. someone LIED.

Norcross norcross

somone said this would be easy. someone LIED.
View GitHub Profile
@norcross
norcross / admin-notice-class.php
Created Jul 27, 2017 — forked from monkeymonk/Notice.php
WordPress Admin Notice Helper Class
View admin-notice-class.php
<?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 Jan 24, 2020 — forked from DHS/PHP Countries Array
PHP array of all country names
View country-array.php
<?php
$countries = array(
'Afghanistan',
'Albania',
'Algeria',
'American Samoa',
'Andorra',
'Angola',
'Anguilla',
View always-login.php
<?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' );
View .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 Aug 1, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View 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 Dec 20, 2015 — forked from crondeau/chilpages-looping.php
modified version of child loops
View chilpages-looping.php
<?php
function rkv_child_pages( $this_page ) {
$args = array(
'fields' => 'ids',
'post_type' => 'work',
'post_parent' => $this_page,
'nopaging' => true,
'orderby' => 'menu_order'
View Image-Waterfall.php
// 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>';