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:

 

Custom Woocommerce ACF Category Filters

We had a client recently that needed to be able to create product filters based on the product categories they were assigned to. This presented a problem because we didn’t want to clog up the taxonomy / category pages with a bunch of filter options and the user also needed to be able to edit these categories in the future.

We took the approach of adding some ACF fields to the product categories and then inserting a meta box on the products based on their selected categories which would list the ACF fields as checkboxes, similar to selecting a taxonomy.

It is hard to explain so here is a bunch of code and images to explain.

Here is our custom meta box displaying the filters that were created in the category page. Notice this is actually displaying the filters from ALL selected categories.
Here are the filters created in one category.
This is what the front end looks like. The checkboxes are FontAwesome icons.

Finally, here is the code needed to accomplish this.

All of this code goes into your “functions.php” file

Here is an example of what the front end HTML might look like.

 

Reorder Posts By Menu Order, then Post Title

This can be done using $args = array( ‘orderby’ => array(‘menu_order’,’title’)) however then you are using a 0 index menu_order (0 menu order goes first) and the first letter of the post title (rather than by say, the last name in the post title). So this is just a function to give a little more control over that ordering

 

List Woocommerce Cart Item Attributes

90% of the time I am very thankful for plugins like Woocommerce, that handle so much of the architecture associated with an e-commerce site.

10% of the time I curse their name in the more profane manner possible. This seems to happen most often when using variable products.

For reasons that defy reason, Woocommerce does not list the variable product’s attributes when it is in your cart. There is also no Woocommerce function, afaik, to easily list a cart items selected attributes. Why on earth would someone want to know what type of product they put in their cart! Bah!

Anyway, here is some simple code to list the attributes for the variable products in your cart:

Hopefully that will save you 1% more time of cursing the name Woocommerce!

Add Custom Fields to Woo Variations

Sometimes each variation needs its own custom fields. Say if you need to add a unique UPC or EAN code. This turned out to be surprisingly simple. Thanks to Remi Corson for the code.

PS. You should check out Remi’s page for pretty much ANYTHING Woocommerce related. It is basically an infinite well of Woo knowledge.

Slick Carousel Basic Usage

Slick Carousel is pretty awesome. Not great in every instance but perfect for many. It is also very mobile friendly including swipe events.

Here is some basic setup code to get the slick slider working. This is being used in combination with Woocommerce thumbnails.

Now just initialize this slider somewhere.