!addcom !keyword New text here!editcom !keyword Edited version of the text here!delcom !keyword
$(user)
| <?php | |
| function foo_no_print_class( $class ) { | |
| return $class . ' print-no'; | |
| } | |
| add_filter( 'get_image_tag_class', 'foo_no_print_class' ); |
| <?php | |
| /** | |
| * Loop through 3 most recent posts from each category | |
| * @see http://codex.wordpress.org/Function_Reference/get_categories | |
| */ | |
| $do_not_duplicate = array(); | |
| $categories = get_categories(); | |
| foreach ( $categories as $category ) : | |
| $args = array( |
| <?php | |
| /* | |
| Plugin Name: Norcross Debug Functions | |
| Plugin URI: https://gist.github.com/norcross/7864205/ | |
| Description: A set of functions I use on all sites while building | |
| Author: Andrew Norcross | |
| Version: 0.0.1 | |
| Requires at least: 3.0 | |
| Author URI: http://andrewnorcross.com | |
| */ |
| <?php | |
| function get_current_url() { | |
| // Get current URL path, stripping out slashes on boundaries | |
| $current_url = trim(esc_url_raw(add_query_arg([])), '/'); | |
| // Get the path of the home URL, stripping out slashes on boundaries | |
| $home_path = trim(parse_url(home_url(), PHP_URL_PATH), '/'); | |
| // If a URL part exists, and the current URL part starts with it... | |
| if ($home_path && strpos($current_url, $home_path) === 0) { | |
| // ... just remove the home URL path form the current URL path | |
| $current_url = trim(substr($current_url, strlen($home_path)), '/'); |
| <?php | |
| /** | |
| * If post goes from "future" (scheduled) or "draft" to "publish" then alert facebook to (re)crawl it. | |
| * @see https://codex.wordpress.org/Post_Status_Transitions#transition_post_status_Hook | |
| */ | |
| function chuck_notify_facebook_scraper( $new_status, $old_status, $post ) { | |
| if ( $new_status != 'publish' ) { | |
| return; | |
| } |
| <?php | |
| /** | |
| * Remove Genesis Framework settings page metaboxes | |
| */ | |
| function chuck_remove_genesis_metaboxes( $_genesis_theme_settings_pagehook ) { | |
| remove_meta_box( 'genesis-theme-settings-version', $_genesis_theme_settings_pagehook, 'main' ); // metabox: Information | |
| remove_meta_box( 'genesis-theme-settings-feeds', $_genesis_theme_settings_pagehook, 'main' ); // metabox: Custom Feeds | |
| remove_meta_box( 'genesis-theme-settings-layout', $_genesis_theme_settings_pagehook, 'main' ); // metabox: Default Layout | |
| remove_meta_box( 'genesis-theme-settings-header', $_genesis_theme_settings_pagehook, 'main' ); // metabox: Header (site/title logo) | |
| remove_meta_box( 'genesis-theme-settings-breadcrumb', $_genesis_theme_settings_pagehook, 'main' ); // metabox: Breadcrumbs |
| <?php | |
| /** | |
| * Global Action to check if RCP user is logged; if not -> auth. | |
| * | |
| * RCP doesn't seem to protect archives that aren't pages or all posts/pages | |
| * by default so this is my fix. | |
| */ | |
| function chuck_is_rcp_active () { | |
| if ( ! rcp_is_active() ) : |
| <?php | |
| /** | |
| * RCP metabox is higher than cpt metafields so | |
| * let's lower that priority a bit | |
| */ | |
| function chuck_rcp_chill_priority() { | |
| return 'low'; | |
| } | |
| add_filter( 'rcp_metabox_priority', 'chuck_rcp_chill_priority' ); |