• You can adapt to your needs

    // Remove query string from static files
    function remove_cssjs_ver( $src ) {
     if( strpos( $src, '?ver=' ) )
     $src = remove_query_arg( 'ver', $src );
     return $src;
    }
    add_filter( 'style_loader_src', 'remove_cssjs_ver', 10, 2 );
    add_filter( 'script_loader_src', 'remove_cssjs_ver', 10, 2 );
    
    // Admin footer modification
    
    function remove_footer_admin ()
    {
        echo '<span id="footer-thankyou"><a href="https://www.topserve.com.ng" target="_blank"><img src="https://exclusively9ja.com/wp-content/uploads/2015/03/logo1.png" alt="Exclusively9ja" width="100"/></a></span><style>#wpfooter{background-color:#ffffff !important}#footer-upgrade{display:none}</style>';
    }
    add_filter('admin_footer_text', 'remove_footer_admin');
    
    // remove URL field comment form
    function crunchify_disable_comment_url($fields) {
        unset($fields['url']);
        return $fields;
    }
    add_filter('comment_form_default_fields','crunchify_disable_comment_url');
    
    //to add defer to loading of scripts - and use defer to keep loading order
    function script_tag_defer($tag, $handle) {
        if (is_admin()){
            return $tag;
        }
        if (strpos($tag, '://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js')) {
          return $tag;
        }
        if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 9.') !==false) {
    	return str_replace(' src',' defer src', $tag);
        }
        else {
            return str_replace(' src',' defer src', $tag);
        }
    }
    add_filter('script_loader_tag', 'script_tag_defer',10,2);
    
    //remove google font
    add_action( 'wp_enqueue_scripts', 'remove_default_stylesheet', 20 );
    
    function remove_default_stylesheet() {
         wp_dequeue_style( 'js_composer_front' );
        wp_deregister_style( 'js_composer_front' );
    }

    See Exclusively9ja.com for site in use

  • The topic ‘My functions.php file’ is closed to new replies.