Adding dates to custom post permalinks in WordPress

Making date-based permalinks for custom posts in WordPress

If you didn’t know already, this blog is not the only thing that we work on — we also take on clients to work on website and web-related projects for them. Recently, we worked on a website project where we had to code a custom WordPress post type into the custom theme we made for the client (yes we make those).

This custom post type (which shall henceforth be called Articles — what we named the post type) was supposed to serve a purpose similar to the default WordPress Post — it was meant to go into a blog section for the website, and the client wanted to be able to assign categories to individual articles. All of this is pretty standard fare when it comes to WordPress customisation, as you can easily figure out how to do it reading official guides and documentation from WordPress:

We needed something a bit more though, as we wanted to customise the permalinks (i.e. auto-generated URL) of our Articles such that they are:

  1. Preceeded by the article slug, e.g. example.com/article/my-article-title
  2. Display the year and month before the post title, e.g. example.com/article/2021/03/my-article-title
  3. Display a list of articles posted on the specified year and month if it was specified in the URL, e.g. example.com/article/2021/03 would show all the articles posted in March 2021.

Want to find out how we did it? Then continue reading.

Continue reading
Setting up Infusionsoft's PHP SDK

Using Keap’s (aka Infusionsoft) PHP SDK (2021)

If you are creating applications that work with Keap CRM — formerly known as Infusionsoft — you might be unsure where to start. After all, many of the guides available online for working with Infusionsoft’s API are outdated. Additionally, although the official documentation is an option, it’s a little too vague, especially if you are new to the whole web API business.

I recently worked on a project where I had to integrate a set of fields in a web form with Keap’s CRM system — that is, users will fill up a web form, and the information will automatically be sent to Keap’s CRM database for storage. After a lot of trial and error, as well as source code reading, I’ve managed to get my form working.

I’ve put together this guide in the hopes that you can have a smoother journey of integrating Keap’s / Infusionsoft’s CRM into your web services.

In Keap’s / Infusionsoft’s defense, their documentation is much better in their GitHub repository, as they have more concrete instructions and examples. Once the API is set up on your web application, the information in the repository is actually very helpful.

Continue reading
Adding virtual hosts on Bitnami Apache

Adding virtual hosts on Bitnami Apache

Over the weekend, I’ve spent a substantial chunk of time figuring out how to add a virtual host onto a client’s subdomain. In laymen’s terms, this means that:

  1. My client has a website hosted on a domain (which we shall call example.com, for confidentiality reasons)
  2. We want to build a web application on app.example.com, which will be entirely separate from example.com.
  3. To save on cost, we want to host app.example.com on the same server that example.com is using (i.e. create a virtual host on the web server).

This means that we have to configure our web server so that it will serve a different webroot depending on the domain it is being accessed from.

Continue reading
Shallow vs. deep copying in Python

Shallow vs. deep copying in Python

If you’ve worked with Lists in Python before, you’ll quickly realise that they work differently from primitives like integers and strings. Consider the following:

a = "hello"
b = a
a = "world"
print(a) # Outputs world
print(b) # Outputs hello

Notice that changing the value of a does not change the value of b. This is called passing by value. In Python, Lists do not behave this way:

a = [2, 3, 4, 5]
b = a
a.append(6)
print(a) # Outputs [2, 3, 4, 5, 6]
print(b) # Outputs [2, 3, 4, 5, 6]

In the above example, notice that changing the value of List a also changes the value of List b. This is because both a and b are referring to the same List, and this is called passing by reference.

Continue reading
Apoca Force - Gameplay

Drawing radar charts for stat UIs in Unity

As part of a school assignment in the past year, my team and I created Apoca Force, a tower defense game where WAIFUs (World Apocalypse Intercepting Frontline Units) are deployed onto a battlefield to combat an undead horde. To provide some variation (and eye candy) in gameplay, the game provides a variety of different WAIFUs for players to deploy.

To display the different stats WAIFUs have, we decided to include a radar graph on our build interface to illustrate the stats of each type of WAIFU. In this article, I will talk about the technicalities involved in making that happen.

I have previously written an article about how we rendered Unity’s NavMesh to show our WAIFUs’ walkable areas. Check it out!

Continue reading
Security for your Ubuntu Droplet

Setting up basic security for your Ubuntu Droplet

Have you recently spun up a new Ubuntu Droplet on DigitalOcean? The other day, when I checked my authentication logs in /var/log/auth.log, I came across several login attempts with random usernames.

Malicious login attempts in Ubuntu
Login attempts by malicious users.

We often take security for granted, but it becomes something of great concern once you start to manage servers of your own. If you were to leave your Droplet as it is, it is only a matter of time before hackers guess your login credentials and gain access to your system. Hence, here are some basic security measures you should set up to prevent others from breaking in:

Continue reading
Fixing Visual Studio's IntelliSense in Unity

Fixing Visual Studio’s IntelliSense (auto-complete) in Unity

If you like our article, do take some time to check out the rest of our site! We have plenty of Unity-related posts, tutorials and even some content on web development!

One of the biggest perks of using Microsoft’s Visual Studio to write your Unity scripts is IntelliSense — a code completion aid in Visual Studio that offers suggestions as you write your code, and contextually presents you with information about classes, properties and methods that you are working with.

Given Unity’s enormous scripting API, IntelliSense is a tremendously helpful feature, especially for coders who are beginning their foray into developing games and software with Unity; and while we’d love to say that IntelliSense is automatically set up and linked to Unity’s API when you install it with the Unity Editor, sometimes that’s just not the case. So, if you’ve got both Unity and Visual Studio set up, but find that IntelliSense is still not offering Unity API suggestions, then this guide is for you.

Visual Studio's IntelliSense for Unity
If IntelliSense doesn’t automatically offer Unity API suggestions like these, then it isn’t working.
Continue reading
Troubleshooting PHP gettext

Debugging PHP gettext

Over the last couple of weeks, I’ve been tinkering with PHP’s gettext to set up internationalisation for one of my web apps (i.e. getting it ready for translation into different languages). Even though there were many step-by-step guides and Stack Overflow topics on the web, all detailing a similar set of instructions, following them did not work things out for me.

After some frustration and a lot of time tinkering, it turns out that these guides were missing some pieces of information. If you are tearing your hair out troubleshooting PHP gettext, this article might be just what you’re looking for.

Continue reading
Apoca Force WAIFUs

Showing Unity’s NavMesh in-game

As part of a school assignment in the past year, my team and I created Apoca Force, a tower defense game where WAIFUs (World Apocalypse Intercepting Frontline Units) are deployed onto a battlefield to combat an undead horde. In this game, WAIFUs serve as the eponymous towers of the genre, but with a twist — by spending some resource, they can be moved after they are deployed.

To denote the areas that WAIFUs can walk on, we created an interface that highlighted walkable areas on the map when players decide to move their WAIFUs. This is what we ended up with:

Enjoyed this article? Then check out this other article about how we drew stat graphs for our WAIFUs on our UI interface.

Continue reading
Organising your Unity Inspector fields with a dropdown filter
Screenshot from video game Dust to Dust. More information in the article.

Organising your Unity Inspector fields with a dropdown filter

Over the past 4 months, my team and I have been working on a rogue-like hack-and-slash game for our school’s final year project called Dust to Dust. We have very high ambitions for the game, and we had never worked on projects as large of a scale as this. Of course, by doing that, the challenges we encountered got bigger as well. We had to keep track of many parameters in developing a role-playing video game, and quickly realised that the time taken to find Inspector properties in the project was getting longer and longer. Furthermore, the project was on a 15-week timeline, so every minute was valuable.

Hence, we needed an effective solution that would ease navigation in the project, and — like before — it became clear that we had to once again extend the Unity Editor to suit our needs.

Continue reading