This file contains hidden or 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 myplugin_remove_homepage_metaboxes() { | |
| if ( isset( $_GET['post'] ) ) { | |
| $post_id = $_GET['post']; | |
| } elseif ( isset( $_POST['post_ID'] ) ) { | |
| $post_id = $_POST['post_ID']; | |
| } | |
| $front_page = get_option( 'page_on_front' ); | |
| if ( ! isset( $post_id ) ) { |
This file contains hidden or 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 myplugin_remove_homepage_delete($allcaps, $cap, $args) { | |
| if ( ! is_super_admin() ) { | |
| if ( 'delete_post' == $args[0] ) { | |
| if ( get_option( 'page_on_front' ) == $args[2] ) { | |
| $allcaps[$cap[0]] = false; | |
| } | |
| } | |
| return $allcaps; | |
| } |
This file contains hidden or 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 exclude_this_page( $query ) { | |
| if( ! is_admin() ) | |
| return $query; | |
| global $pagenow; | |
| if( 'edit.php' == $pagenow && ( get_query_var( 'post_type' ) && 'page' == get_query_var( 'post_type' ) ) ) | |
| $query->set( 'post__not_in', array(2) ); // Change '2' to the ID of your Homepage | |
| return $query; | |
| } |
This file contains hidden or 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
| // Remove default columns from manage view. | |
| function myplugin_custom_manage_post_columns( $columns ) { | |
| unset( $columns['cb'] ); | |
| unset( $columns['title'] ); | |
| unset( $columns['author'] ); | |
| unset( $columns['categories'] ); | |
| unset( $columns['tags'] ); | |
| unset( $columns['comments'] ); | |
| unset( $columns['date'] ); |
This file contains hidden or 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
| // http://webdevstudios.com/2015/02/19/10-things-i-learned-migrating-websites-to-wordpress/ | |
| // In your function where you save the original url, sanitize the filename before you store it | |
| $cleaned_image_filename = santize_file_name( $image_filename ); | |
| update_post_meta( $post_id, ‘_orig_url’, $cleaned_image_filename ); | |
| // In the wds_redirect_old_traffic function update line 9 | |
| $request = santize_file_name( $wp->request ); | |
| // In the wds_get_post_id_from_external_url function update the following on line 35 |
This file contains hidden or 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 myplugin_add_remove_theme_caps() { | |
| $role = get_role( 'client' ); | |
| // This only works, because it accesses the class instance. | |
| // Would allow the author to edit others' posts for current theme only | |
| $role->remove_cap( 'gravityforms_export_entries' ); | |
| $role->add_cap( 'gravityforms_export_entries' ); | |
| gform_full_access |
This file contains hidden or 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
| http://stackoverflow.com/questions/23593897/wordpress-global-post-changed-after-query | |
| global $post; | |
| $backup_post = $post; | |
| ... | |
| $post = $backup_post; |
This file contains hidden or 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
| /** | |
| * Breadcrumbs @ https://wpcom-themes.svn.automattic.com/big-brother/functions.php | |
| */ | |
| function myplugin_breadcrumbs() { ?> | |
| <div class="breadcrumbs"> | |
| <?php | |
| $sep = '<span class="breadcrumbs-seperator">' . __( '»' ) . '</span>'; | |
| $before = '<span class="breadcrumbs-current">' . $sep ; | |
| $after = '</span>'; |
This file contains hidden or 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
| if ( current_theme_supports( 'announcement' ) ) { | |
| function announcement_customizer( $wp_customize ) { | |
| $wp_customize->add_section( 'announcement', array( | |
| 'title' => __( 'Announcement' ), | |
| 'description' => __( 'A summary of this page will appear in the header area of your website.' ), | |
| 'priority' => 64, | |
| ) | |
| ); | |
| $wp_customize->add_setting( 'announcement_page', array( |
This file contains hidden or 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 dbt_gallery_defaults( $settings ) { | |
| $settings['galleryDefaults']['size'] = 'thumbnail'; | |
| $settings['galleryDefaults']['link'] = 'file'; | |
| $settings['galleryDefaults']['columns'] = 2; | |
| return $settings; | |
| } | |
| add_filter( 'media_view_settings', 'dbt_gallery_defaults'); |