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 / 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 / admin.js
Last active August 29, 2015 14:02
code to fix shit for WPEC gallery
function wpsc_update_product_gallery_tab(obj){
var output;
output = '<div id="wpsc_product_gallery">';
output += '<ul>';
for (var i = 0; i < obj.length; i++){
output += '<li>';
output += '<img src="' + obj[i].sizes.thumbnail.url + '">';
output += '<input type="hidden" name="wpsc-product-gallery-imgs[]" value="' + obj[i].id + '">'; // new item to include hidden field with ID
@norcross
norcross / rkv-filter-link-types.php
Created July 27, 2014 17:48
filter the available post types in the internal linking
@norcross
norcross / filter-pages-admin-link.php
Last active August 29, 2015 14:04
change default 'pages' link to show only published
@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 / bypass-auto-update-email.php
Last active August 29, 2015 14:04
Disable the email notification for successful update
<?php
function rkv_bypass_auto_update_email( $send, $type, $core_update, $result ) {
// check our type and bail if successful
if ( ! empty( $type ) && $type == 'success' ) {
return false;
}
// return the send function
return true;
@norcross
norcross / limit-user-dropdown.php
Last active August 29, 2015 14:05
modify user dropdown in delete page
<?php
function rkv_limit_users_delete( $query ) {
// first fetch the screen
$screen = get_current_screen();
// bail if we aren't on our user screen
if ( ! is_object( $screen ) || empty( $screen->base ) || ! empty( $screen->base ) && $screen->base != 'users' ) {
return $query;
}
@norcross
norcross / yoast-ga-menu-move.php
Last active August 29, 2015 14:06
move Yoast Google Analytics top-level nav to a sub menu
/**
* move the main settings page for Yoast Google Analytics
* from it's own parent menu into a submenu page in either
* the Yoast SEO menu or in the general settings
*
* @return null
*/
function rkv_yoast_ga_menu() {
// check for the Yoast GA class in the event the plugin
@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 / 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
});