Include Bootstrap Styles and Scripts In A WordPress Theme From CDN

If you are using WordPress then it’s not a good idea to directly link your stylesheet and JavaScript in the header.php (or footer.php) file. Instead WordPress includes enqueue functions to add them to your theme which is the proper way to add jQuery and other scripts. The following 2 functions should be added to your […]

Force SSL on your PHP site with .htaccess

Force SSL on your PHP site #Force SSL on entire site RewriteEngine On RewriteBase / RewriteCond %{ENV:HTTPS} !on [NC] RewriteRule ^(.*)$ https://(YOURDOMAIN)/$1 [R,L] #Force SSL on a specific directory RewriteEngine On RewriteBase / RewriteCond %{ENV:HTTPS} !on [NC] RewriteRule ^DIRNAME/(.*)$ https://YOURDOMAIN/DIRNAME/$1 [R,L]

How to remove logout confirmation message in WordPress

Bypass wordpress are you sure you want to logout screen when logging out of an already logged out account. /* bypass wordpress are you sure you want to logout screen when logging out of an already logged out account. */ function smart_logout() { if (!is_user_logged_in()) { $smart_redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '/'; […]

How to Display a different favicon for wp-admin

Adding this snippet to the functions.php of your wordpress theme will let you display a different icon for the wp-admin. Don’t forget to upload your favicon.ico to the wp-content directory. Just a little snippet from great people over at wpengineer.com. function favicon4admin() { echo ”; } add_action( ‘admin_head’, ‘favicon4admin’ );

How to Load jQuery from the Google CDN with wp_register_script

There are many reasons to use Google CDN when adding jQuery to the front end of your WordPress site. One of the these reasons is that many of your visitors may not need to download it at all. When your visitors browser sees a Google CDN hosted copy of jQuery and if available will load […]

How to User controlled optional wordpress login redirect

Do you require a more complex way to redirect users around your website when they login. This is a great method to use if you want to give your subscribers the ability to choose the page they are redirected to. You could provide visitors the option to redirect directly to their profile page or a […]

How to Change “select category” name within category dropdown widget

Adding this snippet to the functions.php of your wordpress theme will let you change the name displayed within the select menu category dropdown widget. function _category_dropdown_filter( $cat_args ) { $cat_args[‘show_option_none’] = __(‘My Category’); return $cat_args; } add_filter( ‘widget_categories_dropdown_args’, ‘_category_dropdown_filter’ );