Get Page with get_posts() and setup postdata

Really is a cool way to do things…


ACF Google Maps – Ways to output and format the Address in text form.

You can use Advanced Custom Fields to do some pretty cool things with Google Maps. But often you would want to spit out the address from the map in a formatted form. Here are some examples:

Simplest form:

“111 My Road, City, ST, United States”

Strip the “, United States”

“111 My Road, City, ST”

Strip the “, United States” and add a break making it multiline

” 111 My Road
City, ST ”


ACF Reverse Query on a Post Object

This is a slider from the index.php pulling the testimonials


Sortable Admin Columns with Advanced Custom Fields ACF

Add Advanced Custom Fields ACF to your admin columns in WordPress and be able to sort them.

For this I will add a custom thumbnail and Event start date for an “Event” Custom post type.

First, you need two functions. One to create the columns, overriding what was default in WordPress and one to tell what each column to do.

It’s important to note that the structure of the add_action: ¬†‘manage_{YOUR_POSTTYPE}_posts_custom_column’
and the structure of the filter ‘manage_edit-{YOUR_POSTTYPE}_columns’

Then this final function to sort by Event Date:

Again, note the structure of the filter:

Pull any post or page in the middle of your query without affecting the query

Very simple. This is an example to pull your self in a loop and get out in the middle of another query.


Add Custom Checkout fields to Woocommerce

Here are a couple sample fields you can add to your theme’s functions file to create some Custom Fields on checkout for Woocommerce.

First, add the fields to checkout. There is also a conditional Birthday field…

For the Birthday, check to see if it’s in the cart…

Process the checkout…

Save those fields!

Finally, display those fields on the order backend edit page…

Bonus: Add those fields that go out in the email to the store owner…

In “admin-new-order.php” in the Woocommerce email template file, and after the do_action(‘woocommerce_email_customer_details’)


Custom Social Media Share buttons

This is incomplete. You will need some css for your images and change a couple things in the code below, like the facebook app id to make this all work

and the html


Add to iCal gives wrong time

Add to iCal in Event Espresso adds the wrong time to iCal.¬†Could be due to your timezone setting. By default WordPress is set to UTC, ‘Universal Time’. In my opinion you should leave it at this and any scripts or plugins you write can be amended with the local timestamp which you can use like:

But to solve the original issue with Event Espresso iCal error if you timezone was left to default, you need to change the end of the timestamp in the iCal form. In, “(plugins) EE/modules/ical/EED_Ical.module.php” you can change the line on line 27 from;



Catch that Image

Function that will look for the featured image first, then if no featured image it will look for the first image in the post, then if no image in the post it will show the default.png in your theme’s images folder. (you have to put the default.png in your theme of course.)

Functions File:


Theme File: