Loop Through Multiple File Mimetypes

I needed to check mimetypes to be sure the user knew right away if one of the files they wanted to upload was accepted. Here is (most of) the code I ended up using. You will need to edit to fit your needs.

Here is the HTML being used.

Check out how to get the WordPress mimetype array from PHP into Javascript here.

Copy PHP Array to Javascipt Object

I often need to work with data client side that is returned from the server. Found this neat piece of code which I used to get the available mimetypes so I can validate client side that the file the user is attempting to upload is accepted.

Replace Gravity Forms Selects

I had an earlier post about cross browser safe select replacements. This is a function which replaces the gravity forms plugin select drop downs with those cross browser safe drop downs.

CSS styles. You will need to edit to fit your needs.

 

Woocommerce Edit Query

This was my first Woocommerce project and it was rough getting everything working as expected. This bit of code helped me narrow the query results for Woocommerce. Place in functions.php

 

Register Custom Post Types

I was sick of repeating myself when making CPTs. This is a pretty simple function that makes it easier.

Now this is obviously not a “One Size Fits All” Solution but I find it helpful as a starting point.

Query Custom Post Types

Query WordPress for a particular post type.

If you just want an object and not the entire post loop you can also do this.