WordPress

Remove Edit Title, Add new, Permalink, View Post buttons from Custom Post Type Edit Screens

// Remove Edit Title, Add new, Permalink, View Post buttons from Custom Post Type Edit Screens function posttype_admin_css() { if (current_user_can(‘author’)){ global $post_type; if($post_type == ‘custom_post_type’) { echo ‘<style type=”text/css”>#titlediv,.add-new-h2,#edit-slug-box,#view-post-btn,.updated p a{display: none;}</style>’; } } } add_action(‘admin_head’, ‘posttype_admin_css’); Source: 10+ Useful WordPress Code Snippets

Remove editor only for author based on Custom Post Types

// Remove editor only for author based on Custom Post Types function remove_editor() { if (current_user_can(‘author’)){ remove_post_type_support(‘custom_post_type’,’editor’); } } add_action(‘admin_init’,’remove_editor’); Source: 10+ Useful WordPress Code Snippets

Remove Dynamic Widget Metabox from Custom Post Type Edit Screens

// Remove Dynamic Widget Metabox from Custom Post Type Edit Screens function remove_dynwid_box() { if ($current_user->user_level < 10){ remove_meta_box(‘dynwid’,’custom_post_type’,’side’); } } add_action(‘do_meta_boxes’, ‘remove_dynwid_box’); Source: 10+ Useful WordPress Code Snippets

Remove Featured Image Metabox from Custom Post Type Edit Screens

// Remove Featured Image Metabox from Custom Post Type Edit Screens function remove_image_box() { if ($current_user->user_level < 10){ remove_meta_box(‘postimagediv’,’custom_post_type’,’side’); } } add_action(‘do_meta_boxes’, ‘remove_image_box’); Source: 10+ Useful WordPress Code Snippets

Remove Metaboxes from Custom Post Type Edit Screens

// Remove Metaboxes from Custom Post Type Edit Screens if (is_admin()) : function remove_post_meta_boxes() { if(!current_user_can(‘administrator’)) { remove_meta_box(‘tagsdiv-post_tag’, ‘custom_post_type’, ‘normal’); remove_meta_box(‘categorydiv’, ‘custom_post_type’, ‘normal’); remove_meta_box(‘authordiv’, ‘custom_post_type’, ‘normal’); remove_meta_box(‘postexcerpt’, ‘custom_post_type’, ‘normal’); remove_meta_box(‘trackbacksdiv’, ‘custom_post_type’, ‘normal’); remove_meta_box(‘commentstatusdiv’, ‘custom_post_type’, ‘normal’); remove_meta_box(‘postcustom’, ‘custom_post_type’, ‘normal’); remove_meta_box(‘commentstatusdiv’, ‘custom_post_type’, ‘normal’); remove_meta_box(‘commentsdiv’, ‘custom_post_type’, ‘normal’); remove_meta_box(‘revisionsdiv’, ‘custom_post_type’, ‘normal’); remove_meta_box(‘authordiv’, ‘custom_post_type’, ‘normal’); remove_meta_box(‘pageparentdiv’, ‘custom_post_type’, ‘normal’); remove_meta_box(‘slugdiv’, ‘custom_post_type’, …

Remove Metaboxes from Custom Post Type Edit Screens Read More »

Remove Dashboard Widgets

// Remove Dashboard Widgets function remove_dashboard_widgets() { global $wp_meta_boxes; unset($wp_meta_boxes[‘dashboard’][‘side’][‘core’][‘dashboard_quick_press’]); unset($wp_meta_boxes[‘dashboard’][‘normal’][‘core’][‘dashboard_incoming_links’]); unset($wp_meta_boxes[‘dashboard’][‘normal’][‘core’][‘dashboard_right_now’]); unset($wp_meta_boxes[‘dashboard’][‘normal’][‘core’][‘dashboard_plugins’]); unset($wp_meta_boxes[‘dashboard’][‘side’][‘core’][‘dashboard_recent_drafts’]); unset($wp_meta_boxes[‘dashboard’][‘normal’][‘core’][‘dashboard_recent_comments’]); unset($wp_meta_boxes[‘dashboard’][‘side’][‘core’][‘dashboard_primary’]); unset($wp_meta_boxes[‘dashboard’][‘side’][‘core’][‘dashboard_secondary’]); } if (!current_user_can(‘manage_options’)) { add_action(‘wp_dashboard_setup’, ‘remove_dashboard_widgets’); } Source: 10+ Useful WordPress Code Snippets

Remove Comments menu from Admin Dashboard

// Remove Comments menu from Admin Dashboard function remove_menus () { global $menu; $restricted = array(__(‘Comments’)); end ($menu); while (prev($menu)){ $value = explode(‘ ‘,$menu[key($menu)][0]); if(in_array($value[0] != NULL?$value[0]:”” , $restricted)){unset($menu[key($menu)]);} } } add_action(‘admin_menu’, ‘remove_menus’); Source: 10+ Useful WordPress Code Snippets

Custom post type custom icon

// register the post type register_post_type( static::POSTTYPE, array( ‘menu_icon’ => __( plugins_url( ‘icon-16×16.png’ , __FILE__ ), ‘custom_plugin’ ), ) ); // Style change for 32×32 icon for custom post type add_action(‘admin_head’, ‘custom_header’); function custom_header() { global $post_type; ?> <style> <?php if (($_GET[‘post_type’] == ‘custom_plugin’) || ($post_type == ‘custom_plugin’)) : ?> #icon-edit { background:transparent url(‘<?php echo …

Custom post type custom icon Read More »

WordPress ASCII art

Enjoy this awesome gist by Mark Jaquith! <!– `-/+osssssssssssso+/-` ./oys+:.` `.:+syo/. .+ys:. .:/osyyhhhhyyso/:. ./sy+. /ys: -+ydmmmmmmmmmmmmmmmmmmdy+- :sy/ /h+` -odmmmmmmmmmmmmmmmmmmmmmmmmmmdo- `+h/ :ho` /hmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmds/ `oh: `sy. /hmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmd+ .ys` .ho `sdddhhhyhmmmdyyhhhdddddhhhyydmmmmy oh. .h+ “-dmmy.“ “.ymmmmh +h. `ho ` /mmmmmmmmmmo .dmmmmmmmms ~~ oh` oy .h` ymmmmmmmmmm: /mmmmmmmmmy` -d. yo .d- ymy `dmmmmmmmmmd. ymmmmmmmmmh` /my -d. oy -mmm+ /mmmmmmmmmmy .dmmmmmmmmmy …

WordPress ASCII art Read More »

Disable autocomplete on the front-end for Gravity Forms

Super awesome gist written by my colleague Ronald Huereca. You wanna disable autocomplete on front-end for Gravity Forms, this is just right code snippet for you. <?php add_filter( ‘gform_form_tag’, ‘gform_form_tag_autocomplete’, 11, 2 ); function gform_form_tag_autocomplete( $form_tag, $form ) { if ( is_admin() ) return $form_tag; if ( GFFormsModel::is_html5_enabled() ) { $form_tag = str_replace( ‘>’, ‘ …

Disable autocomplete on the front-end for Gravity Forms Read More »