This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jquery scrolling goodness | |
jQuery(".scroll").click(function() { | |
var target = jQuery(this).attr("href"); | |
jQuery("html, body").animate({ | |
scrollTop: jQuery(target).offset().top}, 1000); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function my_theme_add_editor_styles() { | |
add_editor_style( 'editor-style.css' ); | |
} | |
add_action( 'after_setup_theme', 'my_theme_add_editor_styles' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function revcon_change_post_label() { | |
global $menu; | |
global $submenu; | |
$menu[5][0] = 'Books'; | |
$submenu['edit.php'][5][0] = 'Books'; | |
$submenu['edit.php'][10][0] = 'Add Books'; | |
$submenu['edit.php'][16][0] = 'Books Tags'; | |
echo ''; | |
} | |
function revcon_change_post_object() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function my_custom_post_product() { | |
$labels = array( | |
'name' => _x( 'Products', 'post type general name' ), | |
'singular_name' => _x( 'Product', 'post type singular name' ), | |
'add_new' => _x( 'Add New', 'book' ), | |
'add_new_item' => __( 'Add New Product' ), | |
'edit_item' => __( 'Edit Product' ), | |
'new_item' => __( 'New Product' ), | |
'all_items' => __( 'All Products' ), | |
'view_item' => __( 'View Product' ), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function my_taxonomies_news() { | |
$labels = array( | |
'name' => _x( 'News Categories', 'taxonomy general name' ), | |
'singular_name' => _x( 'News Category', 'taxonomy singular name' ), | |
'search_items' => __( 'Search News Categories' ), | |
'all_items' => __( 'All News Categories' ), | |
'parent_item' => __( 'Parent News Category' ), | |
'parent_item_colon' => __( 'Parent News Category:' ), | |
'edit_item' => __( 'Edit News Category' ), | |
'update_item' => __( 'Update News Category' ), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Hide editor on specific pages. | |
* | |
*/ | |
function hide_editor() { | |
global $pagenow; | |
if( !( 'post.php' == $pagenow ) ) return; |
NewerOlder