How to Fix Drop Down Menu not Working on iPad


    if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
     $(".main-navigation li:has(ul) > a").bind('touchstart',function(e){


  			window.location = $(this).attr("href");



» Read more

Setting permissions for wordpress

Everyone experiencing this issue should execute these commands:

sudo usermod -aG www-data $USER

Adds the currently logged in user to the www-data group.

sudo chown -R www-data:www-data /var/www

Changes the ownership of the /var/www directory to www-data group.

sudo chmod -R 755 /var/www

If this doesn’t fix the issue you’re having, you’ve got something else wrong and bashing DO is not going to help anyone. If you want a managed server, look for hosting elsewhere. If you need help, ask someone or hire an admin that knows how to not only ‘set things up’ but knows how to secure your server as well. You’ll be glad you did. DO is not for novices, even if they have a lot of tutorials.

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 functions.php file to include the required files. It adds the Bootstrap stylesheet & the default theme stylesheet (uncomment the ‘my-style’ line in the pwwp_enqueue_my_scripts() function to enqueue default stylesheet) in the head and the Bootstrap JavaScript & jQuery in the footer. It also tells WordPress that the Bootstrap JavaScript file depends on jQuery being loaded for it to function.

function tc_enqueue_my_scripts() {
    // jQuery is stated as a dependancy of bootstrap-js - it will be loaded by WordPress before the BS scripts 
    wp_enqueue_script( 'bootstrap-js', '//', array('jquery'), true); // all the bootstrap javascript goodness
add_action('wp_enqueue_scripts', 'tc_enqueue_my_scripts');

function tc_enqueue_my_styles() {
    wp_enqueue_style( 'bootstrap', '//' );

    // this will add the stylesheet from it's default theme location if your theme doesn't already
    //wp_enqueue_style( 'my-style', get_template_directory_uri() . '/style.css');
add_action('wp_enqueue_scripts', 'tc_enqueue_my_styles');

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'] : '/';
		wp_safe_redirect( $smart_redirect_to );
	} else {
		$smart_redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '/';
		wp_safe_redirect( $smart_redirect_to );
add_action ( 'login_form_logout' , 'smart_logout' );

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

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 from their browser cache negating the need to download the file again. Adding this snippet to the functions.php of your wordpress theme will register and include jquery from the Google CDN.

You may want to take a look at Googles hosted libraries to see what else is available.

add_action( 'init', 'jquery_register' );
function jquery_register() {
if ( !is_admin() ) {
    wp_deregister_script( 'jquery' );
    wp_register_script( 'jquery', ( '' ), false, null, true );
    wp_enqueue_script( 'jquery' );

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 custom settings page for your wordpress site. Adding this snippet to the functions.php of your wordpress theme will add a select menu to the login screen that will allow your users to choose where they would like to be redirected.


// Fields for redirect
function custom_login_fields() {
                        <strong>Choose your location: </strong>
                        <select name="login_location">
                                <option value="">Select …</option>
                                <option value="<?php bloginfo('url'); ?>#banking">Banking</option>
                                <option value="<?php bloginfo('url'); ?>#insurance">Insurance</option>
                                <option value="<?php echo get_permalink(2); ?>">Securities</option>
// Redirect function
function location_redirect() {
        $location = $_POST['login_location'];
// Add fields to the login form
// Make sure the redirect happens only if your fields are submitted
if ( (isset($_GET['action']) && $_GET['action'] != 'logout') || (isset($_POST['login_location']) && !empty($_POST['login_location'])) )
        add_filter('login_redirect', 'location_redirect', 10, 3);