WordPress: Passing Params to get_template_part()

July 13, 2021 A Goodman

When using the get_template_part function in WordPress, you can pass parameters to it as shown below: Then you can retrieve the passed variables in the template file like this: In this case, $args is a reserved…

Using Docker Compose to speed up WordPress development

December 2, 2020 A Goodman

Using Docker Compose to speed up your WordPress development. Introduction In the old days, to set up a WordPress project on our local computer, we used to create a new MySQL database, manually download the WordPress…

How to insert 4K images in your WordPress posts

June 29, 2020 The Shadow

After editing your php.ini file (some stuff similar to upload_max_filesize = 100M), you can upload big images but still can not insert them into your posts. Even if you select Full Size from the image size…

WordPress: Show related posts by tags

July 13, 2021 The Plumber

This article shows you how to display related posts by tags in WordPress. Place the following snippet in your single.php where you want the related posts to show up (a good spot is right below your…

5 popular websites built with WordPress

March 31, 2021 The Shadow

WordPress is the most popular CMS on the planet, trusted and used by millions of people and companies around the world for nearly 20 years. Let’s have a look at some of the biggest websites using…

PHP array_push examples

May 24, 2020 A Goodman

The array_push function in PHP pushes the input variables onto the end of the given array. Note that the input variables can be string, number, array… Example 1 Code: Output: Example 2 Code: Output:

PHP array_filter() examples

May 5, 2020 A Goodman

The array_filter() function in PHP, as its name so precisely explains, is used to filter elements of an input array using a callback function. The flag argument is optional. Its default value is 0 and will…

PHP array_slice examples

May 5, 2020 A Goodman

The array_slice() function (available in PHP 4, PHP 5, PHP 7) is used to extract a slice of a given array. It returns a new array that contains elements from the input array as specified by…

Xampp on Mac: Permission Denied Error Fix

July 13, 2021 A Goodman

After installing Xampp (even the latest version) on your Mac, you may face some errors related to permissions when working with files (uploading files, resizing images…). The most common output you could see will look like…

PHP: Generating a random number between Min and Max

May 3, 2020 A Goodman

In order to generate a random number within a given range, you can use the rand() or the mt_rand() functions. They are both built-in features in PHP (4, 5, 7). Example: Note: mt_rand() is 4 times…

PHP: Merging Arrays with array_merge() and Spread Syntax

July 13, 2021 A Goodman

In order to merge arrays in PHP (version 7 or 8), you can use the spread syntax (AKA argument unpacking, splat operator) or the array_merge() method. A few examples below will help you understand clearly. Notes:…

How to remove WordPress logo on the admin bar without plugins

January 27, 2020 A Goodman

In order to remove the WordPress logo on the admin bar, just place the code snippet below into your functions.php: Simple as that 🙂

1 2