As I Solve

Bulletproof solutions for the savvy developer.

Category: Wordpress

  • Disallow File Uploads over 2Mb (or any size)

    A quick and easy jQuery snippet to find all file upload inputs & make sure users don’t upload files that are too large. Just include in your $(function(){ }); function $(‘input[type=file]’).each(function(){ $(this).on(‘change’, function() { //this.files[0].size gets the size of your file. if (this.files[0].size > 2097152 || this.files[0].filesize > 2097152) { alert(‘Your file is too large […]

  • WordPress Import Posts – Assign to Existing Author

    When importing posts, pages, or custom posts from an existing WordPress installation, it asks you whether you want to import a user, assign to a new user, or assign to an existing user. If you have already imported users, you want to assign all posts to existing users. However, if you have a lot of […]

  • WordPress – Create a widget area for News (Blog excerpts)

    Working on a WordPress site for a client, they wanted to display a few excerpts of recent Blog posts on their homepage. We were using a custom template for a page that was set as the homepage, but we didn’t have a widget area for that News area. Here’s how to add one: In Functions.php […]