-
(KB)
Using trigonometry to create a diagonal strikethough style with js
I recently had to make a diagonal strikethrough style to use on single word throughout a site.
-
(KB)
Rename the default WordPress posts
To rename the default WordPress posts put this into your functions.php file.
-
(KB)
Disable the archive label in the default WordPress title function
I like to embrace the system with which we build our websites and display things like this with no alteration... But try getting a job with that attitude!!
-
(KB)
Create a matching term in a taxonomy when publishing a custom post
Recently I built a site that needed to have terms that matched the name of every custom post type 'brand'.
-
(KB)
How to disable the default WordPress categories
You need to register the taxonomy ‘category’ again with no arguments. You can do this by adding the below snippet
-
(KB)
Create an archive page of all the media on your WordPress site.
As I had partitioned all of my work into posts I wanted somewhere I could view the images only and then click through to the post with which the image was associated with if the image piqued my interest.
-
(KB)
Stop users adding terms to a taxonomy
I used this to stop anyone adding terms to a taxonomy that we needed to be set to a set of specific terms. Once they were added to the databases across all environments the below was added to the functions file.
-
(KB)
“Disable” a WordPress post type archive page
We will not actually disable the page. As far as I can tell these cannot be disabled (please do let me know if they can). We will redirect it to the home page. Good practice, no, good for the user, no, time saving, yes. Please! If anyone has any ideas that would make this nicer please share.
-
(KB)
A vanilla JS structure for hover states on more than one element
If you want to do some crazy hover effects using javascript on multiple elements on a page then use this structure. This technique is useful if you want to use something from the mousemove event, like the mouse position.
-
(KB)
Adding inline SVGs in WordPress
Finding the best way to include SVG files in Wordpress can be a little confusing. There doesn't seem to be a clear answer anywhere.
-
(KB)
Using a direct SQL query in place of the wp_query loop
This means it isn't running through all the Wordpress functions that are not relevant to our particular scenario thus increasing the speed of the query drastically.
-
(KB)
Correctly setting a different number of posts per page on a WordPress archive page
I found out recently that you should not be using a custom WP_Query on an archive page if you don't want to cause major issues with your pagination. However, for this particular Custom Post Type archive page I needed to set a different number of posts per page than was set in the admin settings for the blog page.
-
(KB)
Writing an admin notice after saving a post in WordPress
I recently had to write an alert to a user after the saving of an ACF options page. I did so by using the Wordpress admin_notices action.
-
(KB)
Getting Google Maps API’s to work with Advanced Custom Fields
Google map embeds have recently become a massive pain in the butt. You need api keys to embed them, which is fine but the documentation is seriously disjointed and overly complicated.
-
(KB)
Add a fade transition to Flickity
This is a hack and it should be noted that if you want a fading slider then you should search for one that has this built in.
-
(KB)
Use Applescript to open a list of URL’s in Google Chrome
This Applescript can be used in Mac's Automator application to receive a list of urls and open them all in new tabs in Google Chrome.
-
(KB)
Get the Featured Image URL in WordPress
I looked for an elegant way to find the URL of a specific size of the Featured Image in Wordpress for a while. This is a nice way.
-
(KB)
Setting up .htaccess URL Redirects in WordPress
The correct way to setup redirects within the Wordpress .htaccess file is to put your redirects above the Wordpress pretty permalinks code.
-
(KB)
Scheduling a category change, based on an Advanced Custom Field value, when a post is saved using a WordPress CRON job
In a nutshell we needed to change an individual post's category on a given date (via an ACF field) sometime in the future.
-
(KB)
Open a list of URL’s in Google Chrome using Mac Automator
This is a relatively simple task but important for us to begin automating some of the more dreary tasks we have to complete in the studio.
-
(KB)
A comprehensive argument list for WP Query
https://gist.github.com/luetkemj/2023628
-
(KB)
A list of the default settings for flexslider
The documentation does not have all of these listed (as far as I can tell) but here they are pulled straight from the code.
-
(KB)
Add custom image sizes to the WordPress media upload image size menu
When adding a custom image size in your Wordpress functions file using add_image_size() it is not automatically added to your media upload image size dropdown menu.
-
(KB)
Stop a function that has been started with javascript’s setTimeout() function
I created a scroll animation that I wanted to happen 3 seconds after the page had loaded.
-
(KB)
Test if a user has interacted with your page using jquery
Here is some simple jQuery to test if a user has scrolled or clicked on your page.
-
(KB)
Useful SSH commands for working with public/private keys
Below are a list of some useful commands for working with public/private keys on a server over ssh.
-
(KB)
Find the src of a particlular size of the WordPress post thumbnail
I now often need to use srcset to provide a list of possible images for the browser to choose from I need to find the urls of various sizes of the Featured Image.
-
(KB)
Passing variables to a template part in WordPress
I then wanted to access the $count variable that I had attached to my Wordpress loop within that template.
-
(KB)
Rename a local and remote branch in git
If you have named a branch incorrectly AND pushed this to the remote repository follow these steps before any other developers get a chance to jump on you and give you shit for not correctly following naming conventions.
-
(KB)
Adding just the Bootstrap grid using less
Sometimes we want to use only the Bootstrap grid in a project and not everything else.