My WordPress base theme

Before the start of every WordPress theme that I develop, I use a simple basis. This is a theme with a number of patterns that I always use. The files and directories css grid.css reset.css responsive.css includes script-enqueue.php helpers.php js main.js images header.php footer.php functions.php index.php style.css CSS directory My css directory consists of 3 […]

WordPress get display name

Depending on whether you have the user’s ID (If not, checkout: Get user ID in every situation) you can get the display name by creating the user object first: When the user object is created you can simply obtain the display name from it as follows:

Get user ID in every situation

WordPress offers a number of options to obtain the user ID. There are various options depending on the situation. There are 3 types of situations: A list of users The current logged-in user A specific user A list of users When iterating over a list of users it is pretty simple to obtain the ID […]

WordPress get domain

There are times when you only want to use your domain to show in your footer, for example, or use it as a dynamic logo. In order to obtain the domain you need your site url and then retrieve the protocols here. You can do this in the following ways: The reason I use site_url() […]

Difference between site url and home url

WordPress has 2 inbuilt functionalities to get the site url: The site_url() will always be the location where you can reach the site by tacking on /wp-adminon the end, while home_url() would not reliably be this location. You can also get this same field by using get_bloginfo( ‘wpurl’ ). The home_url() would be where you have set your homepage by setting General […]