Cross Browser Select Replacement

I hate the select dropdown. It has to be different on every freaking browser. Here is a little bit of code to create your own select dropdown. Can be styled like any normal div so is safe on every browser…as long as they have javascript enabled…and if they don’t…fuck them (or I guess you could check for noscript and just place a normal select)

Here is the CSS used to style

Please note: This is setup to be REALLY REALLY UGLY. You will NEED to update the CSS.

Update:

When these are created dynamically we need to make sure they are all reset and working as expected. Just declaring .on(‘click’) doesn’t work. Here is the function for that, which should be run after any new dropdowns are created.

NOTE: This replaces the above javascript. If you need dynamic dropdowns just run this function.

 

Paypal Payflow

I had a project that required paypal payflow. This is what I found to get the project working.

 Edit: This was a pretty quick post and I didn’t give much information as to what is really going on here.

This code snippet will go on your page wherever you like and create a PayPal button which will direct you to a PayPal page. For PayPal advanced you need to setup a page with PayPal and a return page on your site.

Login to https://manager.paypal.com and go to the Service Settings tab and click on Set Up. You will need to setup some information here. I don’t know that I can give you all the info you need for this but I think the video I linked in my comments talks about the info you need here. If not there are other sources which can inform you about what to put here.

Once you get that info setup next go to the Customize Tab that you can edit to have a similar feel to your site. This customized page is actually hosted by PayPal and is the page that users will be directed to after they click on your
“Buy Button”.

Lastly, once the user finishes filling out that form and completes the payment they will be returned to whatever page you setup in the earlier setup as the “Return URL”. PayPal will also at this time send an IPN to whatever script you have setup for IPN (this is optional but it is recommended because otherwise you cannot CONFIRM that a payment was actually made).

That should be everything. It isn’t going to be fun, trust me, but it should work.

Recursively Remove a Directory With Files

Title explains.

 

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.

Get Url

…get the url.

source: http://css-tricks.com/snippets/php/get-current-page-url/

 

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.