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
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 / admin.js
Last active Aug 29, 2015
code to fix shit for WPEC gallery
View admin.js
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 Jul 27, 2014
filter the available post types in the internal linking
View rkv-filter-link-types.php
@norcross
norcross / filter-pages-admin-link.php
Last active Aug 29, 2015
change default 'pages' link to show only published
View filter-pages-admin-link.php
@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
@norcross
norcross / bypass-auto-update-email.php
Last active Aug 29, 2015
Disable the email notification for successful update
View bypass-auto-update-email.php
<?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 Aug 29, 2015
modify user dropdown in delete page
View limit-user-dropdown.php
<?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 Aug 29, 2015
move Yoast Google Analytics top-level nav to a sub menu
View yoast-ga-menu-move.php
/**
* 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
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 / on-click-example.js
Created Oct 20, 2014
example of using on.click with dynamic elements
View on-click-example.js
// 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
});