Custom CSS for the login page and create wp-login.css in your theme folder function wpfme_loginCSS() { echo ‘<link rel=”stylesheet” type=”text/css” href=”‘.get_bloginfo(‘template_directory’).’/wp-login.css”/>’;; } add_action(‘login_head’, ‘wpfme_loginCSS’);
Category: WordPress Frontend
Remove Paragraph Tags From Around Images
function filter_ptags_on_images($content){ return preg_replace(‘/<p>\s*(<a .*>)?\s*(<img .* \/>)\s*(<\/a>)?\s*<\/p>/iU’, ‘\1\2\3’, $content); } add_filter(‘the_content’, ‘filter_ptags_on_images’);
Kitchen Sink 2
Custom CSS for the login page Create wp-login.css in your theme folder function wpfme_loginCSS() { echo ”; } add_action(‘login_head’, ‘wpfme_loginCSS’); function wpfme_has_sidebar($classes) { if (is_active_sidebar(‘sidebar’)) { // add ‘class-name’ to the $classes array $classes[] = ‘has_sidebar’; } // return the $classes array return $classes; } add_filter(‘body_class’,’wpfme_has_sidebar’); Call Googles HTML5 Shim, but only for users on […]
Create a PDF viewer Shortcode
If you’re using PDF files on your WordPress blog, it could be very cool to give your users the chance to open them using Google Docs. The following recipe will show you how you can do that. The first step is to paste the following code into your functions.php file: function pdflink($attr, $content) { return […]
Allow upload of more file types
WordPress uploader won’t let you upload some filetypes. If you need to upload other file types this will allow you to do it. Paste the code in functions.php file. If needed, you can add more file types by adding them on line 4, separated by a pipe (|) <?php function addUploadMimes($mimes) { $mimes = array_merge($mimes, […]
Detect mobile visitors
First have to get the code from detectmobilebrowsers.mobi and upload it to your theme directory. Once done, simply open your header.php file and place the following at the top of the file. Don’t forget to edit line 5 according to the page where you’d like to redirect mobile users. include(‘mobile_device_detect.php’); $mobile = mobile_device_detect(); if ($mobile==true) […]
Show the number of results found
Search results pages are important for a website UX, so it should be pretty useful to the user. Problem is many search results page give no information about how many pages on what I’m searching for there are in a website. Thanks to the following line of code in your search.php file, you’ll be able […]
Change the post auto-save interval
The auto-save feature is your safety net: automagically WordPress saves your work, so you don’t have to worry about it in the event of a browser crash or a blackout. For some users though, the 1 minute default could be a little too much and they keep interrupting their work to push the save button. […]
Move Your WP-Content Folders
The wp-content folder contains your themes, plugins and uploads. Certain plugins, such as caching plugins, also use the wp-content folder to store data. Due to this, the wp-content folder is frequently a target for hackers, particularly those that insert malware into your theme files. You can make it difficult for people to find your wp-content […]
Remove WordPress Logo
WordPress 3.1 adds an admin bar, which includes a handful of links and the WordPress logo. If you are going to handout websites to a client and you want it to be brandless, here is the function to remove that WordPress logo. function annointed_admin_bar_remove() { global $wp_admin_bar; /* Remove their stuff */ $wp_admin_bar->remove_menu(‘wp-logo’); } add_action(‘wp_before_admin_bar_render’, […]