A Better GForms Repeater Example

The Gravity Forms repeater field example is helpful, but has multiple issues that don’t make themselves apparent until you try to implement it.

Thankfully Giorgos Sarigiannidis has a better repeater example that solves some of the most troubling issues of the repeater field.

Here is my example of the same idea, but using a different form as the fields in the repeater. This allows the client to update the fields in the repeater themselves.

Helpful Javascript Prototype Functions

Sometimes the built in functionality for various Javascript primitives is not enough. Here is an assortment of useful Prototype functions. Enjoy!

 

Multiple Custom Query with paginate_links

I sometimes have a need to have multiple paginations for multiple queries on a single page. Whenever possible I like to use the build in WordPress helper functions for this purpose rather than rolling my own. However, WordPress’ built in pageinate_links is really meant for WP custom queries…and preferably one query per page.

Here is an example of how you can use this built in function for your own queries! We are using an example which involves three different email lists we need to display.

First, setup your queries:

Second, display your results: Note, I am leaving out a lot of the display code, but all the relevant pagination code should be here.

Notice at the bottom of this loop we are calling our pagination function for each list. The important thing to note here is that we are using a separate ‘type’ variable so we know which list we are paginating.

Lastly, here is the actual pagination function:

 

ACF Gallery Saved to Specific Folder

Recently we had a client that wanted to make sure all of the files in one of their galleries was in a specific directory instead of the default upload/year/month directory.

Here is a simple function to make sure that happens, including updating all previous files uploaded to that gallery.

 

JS Capitalize a String

Just a simple String prototype to capitalize the first letter of the string.

 

Convert Form to JS Object

This function will take your entire HTML form and convert all the inputs into a single JS object! Thanks to Dave over at Stack Overflow!

Usage is as simple as:

var formObject= $(‘form’).serializeObject();
Requires jQuery