Snippets

Netlify x Hugo : using custom headers for better caching

Netlify turns off caching by default. Learn how to cache assets using Hugo and Netlify's custom headers.
#api #hugo

Load the next page using ajax

Simply no plugin needed.
#jquery #wordpress

Get the *actual* page ID in WordPress archives

Useful if you want to retrieve specific page ID's from an archive template
#wordpress

List a post's terms without permalinks

Easily get a post's terms and list them with separators.
#wordpress

Check if a device is a touchscreen

Sometimes it's useful to know if the device a user is visiting on is a touchscreen or not. This is because touchscreens don't generally render things like hover states.
#javascript

Check if background-attachment:fixed is supported

#css

Check if the_content() has content

#wordpress

Responsive CSS circles

#css

Simple Sticky Header

A quick and easy way to make a header sticky using jquery
#css #jquery

Output data to multiple elements with one loop

#php #wordpress

Alter a query in WordPress with pre_get_posts

You can alter multiple queries with ease using this single function.
#wordpress

Shorthand if/else statements in PHP & JS

#php #javascript

Quickly access a page's object in WordPress

#wordpress

Centering elements with CSS

You wouldn't think it, but centering elements with CSS has got to be one of the most finicky things ever.
#css

Style form placeholders

Browser hacks incoming.
#css

Load Instagram posts using ajax

Load instagram posts without a developer account.
#jquery #api

Responsive images in WordPress with srcset

srcset is handled extremely well by WordPress. I use this tag for almost all images I serve on a page (even backgrounds).
#wordpress