-
Check If Post Slug Exists
In the rare cases when you need to check if a post exists by slug, here goes a function to handle that. Note that the slug in WordPress is internally referred as post_name. Include the function below in your WordPress project. You can add it to your functions.php file in your theme or any file…
-
Overwrite Default Post Permalinks
Every WordPress post has a permalink by default. The permalink is displayed, as expected, by the the_permalink() function. In some cases, we might need to enforce another URL to a post as its permalink, be it another link within the site or an external URL. We can provide the custom URL through a custom field…
-
A Guide to Actions and Filters in WordPress
WordPress comes with this built-in API that allows us to hook custom functionality into the rest of WordPress. We can provide that extra functionality through plugins or themes. These are called hooks and they are either actions or filters. Actions allow us to run custom functions at a certain points of a request, while filters…
-
How to Get Post Slug in WordPress
The post slug is the part of the URL of a post or page at the last section. E.g.: Page: https://wplancer.com/about/Post: https://wplancer.com/2015/09/post-slug-here/ There are two ways to get the slug in WordPress inside the loop. The first way is to access the $post object that is available inside the loop. The second way is to…
-
5 Tips to Being a Better WordPress Developer
It happens to every freelancer to be in need of outsourcing some work once in a while. It has happened to me too. I hired this good fellow from India a year back to do a couple of projects while I was doing other work. But being a quality freak, I soon found out that…
-
Infinite next and previous post looping in WordPress
It has happened to me several times in my career as a WordPress freelancer to be in need of a infinite next and previous post looping in WordPress. And I have a solution for that.
-
Minimalist WordPress Theme Development
When I began to explore the WordPress theme code at my beginnings with WordPress, I came across a problem that I could solve only after a while. At that time I had no idea of minimalist web design, yet I wanted to stick to a minimalist web development habit, i.e. code less and have less…