Skip to content

Instantly share code, notes, and snippets.

View steppohub's full-sized avatar

Steppo steppohub

View GitHub Profile
@steppohub
steppohub / Remove default password nag
Created November 27, 2014 22:53
Remove annoying (problematic!) default password nag that doesn't disappear
add_action('admin_notices', 'aa99_delete_pass_nag', 1);
function aa99_delete_pass_nag() {
remove_action('admin_notices','default_password_nag');
}
function aa99_add_password_nag() {
global $pagenow;
if ( 'profile.php' == $pagenow || ! get_user_option('default_password_nag') )
return;
@steppohub
steppohub / Aussie gravity forms address
Created December 2, 2014 00:51
Aussie Gravity Forms address
// gravity form hacks
add_filter("gform_address_zip", "change_address_zip", 10, 2);
function change_address_zip($label, $form_id){
return "Postcode";
}
add_filter("gform_address_state", "change_address_state", 10, 2);
function change_address_state($label, $form_id){
return "State";
@steppohub
steppohub / editor style
Created December 8, 2014 03:11
editor styles adding
function my_theme_add_editor_styles() {
add_editor_style( 'editor-style.css' );
}
add_action( 'after_setup_theme', 'my_theme_add_editor_styles' );
@steppohub
steppohub / jquery scrolling goodness
Created December 23, 2014 03:45
jquery scrolling goodness
jquery scrolling goodness
jQuery(".scroll").click(function() {
var target = jQuery(this).attr("href");
jQuery("html, body").animate({
scrollTop: jQuery(target).offset().top}, 1000);
});
@steppohub
steppohub / Woocommerce alphabetical sorting with cool ignore 'the' and 'an' function
Created January 22, 2015 23:18
order posts (woocommerce products) alphabetically but ignore certain words, eg 'The' and 'An'
/**
* Cool orderby function from Monkey Puzzle. Adapted from:
* Tutorial: http://www.skyverge.com/blog/sort-woocommerce-products-custom-fields/
**/
function monkey_ordering_args( $sort_args ) {
$orderby_value = isset( $_GET['orderby'] ) ? woocommerce_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) );
switch( $orderby_value ) {
// Name your sortby key whatever you'd like; must correspond to the $sortby in the next function
<?php $user_id = get_current_user_id();
$groups_user = new Groups_User( $user_id );
$groups = $groups_user->groups;
$my_groups = array();
foreach($groups as $g) {
$my_groups[] = $g->name;