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

February 22, 2022 A Goodman

This article is about 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,…

How to insert 4K images in your WordPress posts

January 26, 2022 The Shadow

After editing your php.ini file (setting upload_max_filesize = 100M or another big number), you can upload big images but still can not insert them into your posts. Even if you select Full Size from the image…

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 (2022)

January 1, 2022 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

February 22, 2022 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: Further reading:…

PHP array_filter() examples

February 22, 2022 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. Syntax: The flag argument is optional. Its default value is 0 and…

PHP array_slice examples

February 22, 2022 A Goodman

The array_slice() function (available since PHP 4) 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 the start and length…

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

February 22, 2022 A Goodman

In order to generate a random number within a given range, you can use the rand() or the mt_rand() functions. Example: Output (the output is not consistent will change each time you execute your code): Note:…

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 26, 2022 A Goodman

In order to remove the WordPress logo from the admin bar, just place the code snippet below into your functions.php: Simple as that. Further reading: WordPress: Passing Params to get_template_part() Using Docker Compose to speed up…

1 2