// make TinyMCE allow iframes add_filter(‘tiny_mce_before_init’, create_function( ‘$a’, ‘$a[“extended_valid_elements”] = “iframe[id|class|title|style|align| frameborder|height|longdesc|marginheight|marginwidth|name|scrolling|src|width]”; return $a;’) );
Articles Tagged: Look & Feel
Display Specific Content only for logged in users
Tested on: WordPress 3.0.1 function content_only4logged_in($content) { // ALL LOGGED IN USERS if ( is_user_logged_in() && !is_null($content) && !is_feed() ) { return $content; } else { $content = wp_html_excerpt( $content, 80 ); $content .= ‘ …’; $content .= __( ‘Sorry, more of this content is only available for logged users.’, FB_TEXTDOMAIN ); return $content; } […]
Custom excerpt length
function excerpt($num) { $limit = $num+1; $excerpt = explode(‘ ‘, get_the_excerpt(), $limit); array_pop($excerpt); $excerpt = implode(” “,$excerpt).”… (<a href='” .get_permalink($post->ID) .” ‘>Read more</a>)”; echo $excerpt; } Limit the length of the displayed excerpt by writing in the theme: excerpt(’20’); Example: <?php excerpt(’22’); ?> This will limit the excerpt to 22 characters. The excerpt will be […]
Custom Dashboard CSS
/* Change WordPress dashboard CSS */ function custom_admin_styles() { echo ‘<style type=”text/css”>#wphead{background:#069}</style>’; } add_action(‘admin_head’, ‘custom_admin_styles’); function custom_admin_styles() { echo ‘<style type=”text/css”>#wp-admin-bar-new-content{display:none;}</style>’; echo ‘<style type=”text/css”>#wp-admin-bar-comments{display:none;}</style>’; echo ‘<style type=”text/css”>#wp-admin-bar-wp-logo{display:none;}</style>’; echo ‘<style type=”text/css”>#screen-meta-links{display:none;}</style>’; } You can add any changes to the css between the tags.
Custom Admin Footer
function custom_admin_footer() { echo ‘Welcome to my blog! No More Documentation Links!’; } add_filter(‘admin_footer_text’, ‘custom_admin_footer’);
Custom Favicon WP-Admin
function admin_favicon() { echo ‘<link rel=”shortcut icon” type=”image/x-icon” href=”‘ . get_bloginfo(‘template_directory’) . ‘/images/favicon.ico” />’; } add_action( ‘admin_head’, ‘admin_favicon’ );
Replace WP Admin Logo
function new_admin_logo() { echo ‘<style type=”text/css”>#header-logo { background-image: url(‘.get_bloginfo(‘template_directory’).’/images/admin_logo.png) !important; }</style>’; } add_action(‘admin_head’, ‘new_admin_logo’);
Excerpt Ending
function new_excerpt_more($more) { return ‘…’; } add_filter(‘excerpt_more’, ‘new_excerpt_more’);
Change the “Howdy” message to “Welcome”
This is what is running on this site: function change_howdy($translated, $text, $domain) { if (!is_admin() || ‘default’ != $domain) return $translated; if (false !== strpos($translated, ‘Howdy’)) return str_replace(‘Howdy’, ‘Welcome’, $translated); return $translated; } add_filter(‘gettext’, ‘change_howdy’, 10, 3); With this function you can customize the “Howdy” message in top right of your admin area. This […]
Custom Admin Footer
// customize admin footer text function custom_admin_footer() { echo ‘add your custom footer text and html here’; } add_filter(‘admin_footer_text’, ‘custom_admin_footer’); I use this for client sites as a simple point of reference to contact me as the dev.