Create a Child Theme in WordPress

Hello! Creating a child theme in WordPress allows you to make changes to an existing theme without modifying its core files. Here’s a step-by-step guide on how to create a child theme:

Create a new folder on your computer or in your host server. Give it a name that represents your child theme (e.g., my-child-theme).

Inside the newly created folder, create a new file called style.css. Open it in a text editor.

In the style.css file, add the following code to define the information about your child theme:

/*
Theme Name: My Beautiful Child Theme
Template: twentytwentytwo
*/

Replace My Beautiful Child Theme with the desired name for your child theme, and twentytwentytwo with the name of the parent theme you want to create a child theme for.

Save your style.css

If you want to override specific template files from the parent theme, create a new folder within your child theme folder called template-parts. You can replicate the directory structure and file names of the templates you want to override. For example, if you want to override the content.php file, create the following structure: my-child-theme/template-parts/content.php.

Next, upload the entire child theme folder (including the style.css file and the template-parts folder if applicable) to the wp-content/themes/ directory on your WordPress site.

Log in to your WordPress admin area and go to Appearance > Themes. You should see your new child theme in the list. Now, select “Activate” button to activate your child theme.

Always refer to the official WordPress documentation for best practices.

Contact me with any questions. Also, check out my IT Handyman shop. I make my own coffee mugs and T-Shirt designs. Thanks!

Remove Powered by WordPress footer from Twenty Twenty-One Theme

To remove this “Powered by WordPress” from the footer is quite easy. For best practice I suggest you create a child theme first. If you don’t you will loose the changes whenever you update your theme. A client called me to make this simple change for his new website about Latin America Coffee.

I put together these simple steps. Let me know what you think. You can always contact me if you have any questions.

To remove the footer from the Twenty Twenty-One theme in WordPress, you can modify the theme files. Here’s how you can do it:

  1. Access your WordPress installation files via FTP, SSH or use a file manager provided by your hosting provider.
  2. Navigate to the directory wp-content/themes/twentytwentyone/.
  3. Locate the footer.php file within the Twenty Twenty-One theme folder.
  4. Open the footer.php file in a text editor.
  5. Find the section of code that represents the footer content. It typically starts with <div class="powered by"> or something similar.
  6. Delete or comment out the code for the footer content that you want to remove. You can remove the entire section of code related to the footer or make any changes you like.
  7. Save the changes to the footer.php file.

After following these steps, the footer content should be removed from your Twenty Twenty-One theme.

Remember, always have a backup of your files just in case. I will keep coding with coffee until I die. Thanks!

Format External HD for macOS and Windows

If you want to use an external hard drive that can be used on both Mac and Windows computers, it’s recommended to use the exFAT file system.

exFAT is a file system that is supported by both Mac and Windows operating systems, as well as by other systems like Linux. This means that you can use the same external hard drive on a Mac and a Windows computer without any issues.

One of the advantages of exFAT is that it allows for large file sizes and partition sizes, which is useful if you want to store or transfer large files like video or music files. exFAT also supports file and folder names in various character sets, which is important if you want to use special characters in your file names.

It’s worth noting that if you plan to use the external hard drive primarily with a Mac, you can also use the Mac OS Extended (Journaled) file system, also known as HFS+, which is the default file system used by Mac computers. However, this file system is not natively supported by Windows, so you would need to install third-party software to read and write to the drive on a Windows computer. Using exFAT would eliminate the need for third-party software on Windows.

In summary, if you want to use an external hard drive on both Mac and Windows computers, it’s recommended to use the exFAT file system, as it is supported by both operating systems and allows for large file sizes and folder names in various character sets.

Remove default Storefront footer

A customer called me saying he was creating an online store for selling cool hats online. The customer was using the default Storefront theme in WordPress.

I have some experience setting up online stores. After setting up some products, permalinks and etc. We saw the theme was still displaying the default credit footer “Built with Storefront & WooCommerce”. We wanted to remove it. There are many ways to do this including plugins. I tend to stay away from installing too many plugins in WordPress – specially when the solution is simple.

I found the two simplest ways to remove the default storefront footer credits:

  1. Using CSS. Navigate to your WordPress Dashboard > Appearance > Customize and go to Additional CSS tab add the following CSS code:
.site-info a {
display: none;
}
  1. Using PHP code. Enter the below in your function.php file in your theme:
remove_action(‘storefront_footer’, ‘storefront_credit’,20);

Hope this is helpful. Contact me if you have any questions. Thanks!

Linux dig Command

The Linux dig command is useful for DNS lookup and to query specific DNS name servers.

Basic syntax is:

dig hostname

This will give you a generic answer similar to this:

; <<>> DiG 9.10.6 <<>> oopsla.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 31918
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4000
;; QUESTION SECTION:
;oopsla.com.			IN	A
;; ANSWER SECTION:
oopsla.com.		8	IN	A	54.147.36.143
oopsla.com.		8	IN	A	54.173.18.128
;; Query time: 45 msec
;; SERVER: 172.16.10.108#53(172.16.10.108)
;; WHEN: Wed Mar 22 10:54:37 EDT 2023
;; MSG SIZE  rcvd: 71

To ask a specific DNS name server use the below Linux dig command:

dig @dns-name-server <hostnameToQuery>

Select DNS query type with the dig command. The syntax is below:

dig hostname type

For example, you want to query mail records(MX records)

dig myhostname MX

Query for A records:

dig cocotu.com A

If you like to find the hostname of an IP address:

dig <sampleIP>
dig 32.124.233.153

Hope you like this brief tutorial. If you like to support me check out my code with coffee T-Shirt I designed myself. Also, contact me if you have any questions.Thanks.

Create Symbolic Links in Linux

Symbolic links in Linux is the same as creating a shortcut in Windows.

Use the ln command to create symbolic links. I was a little confusing to me when I was learning about it. But, then I got it. After a walk in the new Long Island RR station at the Grand Central Terminal in New York City. I decided to put together some examples:

To create a symbolic link to a file using the ln command.

ln -s source_file optional_symbolic_link

Always remember to use the switch -s. If not, you will create a hard link instead. Remember, the ln command will only give and output when it fails, otherwise nothing will be return nothing if successful.

Now check that a symbolic link was created by running ls -l

lrwxr-xr-x   1 rgm  staff  6 Mar 16 14:29 link_file -> source_file

If you see the ‘l’ at the beginning of the output it means ‘this is a symbolic link’ Also, the part link_file -> source_file showing that arrow means a symbolic link was created.

Same process work for creating symbolic links to directories.

To remove symbolic links there are two options:

rm created_link

or:

unlink created_link

The ‘link_file’ does NOT need to be created first. I was confused by this. As you can see creating symbolic Links in Linux is quite simple.

Contact me if you have any questions. You can also leave a comment below.

Disable SELinux RedHat/Centos Server

To disable SELinux on RedHat/Centos server is an easy process. All we need is to edit a config file located here:

/etc/selinux/config

Use your favorite text editor (I like vim) and edit the above file:

vim /etc/selinux/config

Change the value to SELINUX=disabled

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#       targeted - Targeted processes are protected,
#       mls - Multi Level Security protection.
SELINUXTYPE=targeted

Then, you must reboot your RedHat/Centos server in order for changes take effect:

sudo reboot

That’s all! Go now and brew your favorite coffee. You can always contact me if you have any questions or write a comment below.

Changes in Flask Don’t Show in Docker Compose

When working on my blood pressure readings app I noticed changes in Flask Don’t Show in Docker Compose automatically. I had to do a docker compose down and then up to see a simple change to one of my HTML template files.

This got me very frustrated and I had to run to the kitchen a brew a nice cup of specialty coffee from Peru.

After brewing my coffee I noticed I change a value in my docker compose file. It was under the environment. I changed the value FLASK_DEBUG: to ‘0’ which turns OFF debug mode. When running you Flask app in debug mode using docker compose you can see instantaneous changes in your browser.

This is my service ‘www’ defined in my docker-compose.yml:

www:
    restart: always
    build: www/.
    depends_on:
        db:
          condition: service_started
    volumes:
      - ./www:/opt/www
      #- ./www/mbp/templates:/opt/www/templates
    env_file:
      - ./www/.env
    environment:
      #have the app run in debug mode. Change to 0 to turn OFF. if you change to 0 you won't see 
      #instant changes. You will need to restart docker compose down/up
      FLASK_DEBUG: 1

I will be posting more details about this app I’m developing in Flask using Docker in the near future. For now, you can contact me and also check my ITPro Helper shop for cool coffee mugs and T-Shirts I design.

The pg_trgm PostgreSQL extension is not present. The extension is required by Drupal 10

I got this pg_trgm PostgreSQL error after trying to run Drupal and Postgres using Docker compose for testing purposes. After taking the NYC subway to my home office I decided to look into this.

The solution for this error was to install the missing extension in Postgres. Not sure why this is not installed by default. Maybe that’s a topic for a different post.

To quickly install the missing postgres extension and fix this pg_trgm PostgreSQL error I logged into my docker container by running the below command:

docker exec -it <nameOfContainer> bash

I then logged into postgres using:

psql -U <DB_USERNAME>

then switch to the database you want to install the extension:

\c <DB_NAME>

Run the below command to install the extension:

CREATE EXTENSION pg_trgm;

Logout and if you get further errors try installing the module for your Linux OS:

Ubuntu/Debian:

sudo apt install postgresql-contrib

Fedora:

sudo dnf install postgresql-contrib

Research your OS documentation for installing this postgres extension.

Clean Install macOS Without a USB

Performing a clean install macOS without a USB is fairly easy compared to other operating systems. I know traditionally most IT admins (IT Handy men) think about using a USB to quickly wipe and re-install a OS. But, some times there is NO USB available or the laptop does NOT have a USB port anymore or you might not have an adapter handy(This sucks!)

After brewing my own coffee at home and taking a walk around NYC and noticing so many red fire police call boxes I decided to put this brief tutorial together.

This is easy to do.

Before you start to Clean install macOS

Always! Always! backup, backup and backup your DATA. This process will erase all data. There’s NO going back.

Start the process

  1. Restart your mac or turn it OFF and the ON. While the mac is starting hold down Command + R keys.
  2. Release the keys when you see the Apple logo.
  3. You will see a “macOS Utilities” window. Select Disk Utility and Erase you main mac hard disk.
  4. Once the disk has been erased close Disk Utility window. You will be taken back to the “macOS Utilities” window.
  5. Now, connect your mac to the internet via Wifi or Ethernet cable(if possible).
  6. Select Reinstall macOS in the “macOS Utilities” window.
  7. Follow the instructions and make sure you select the HD you erased previously. This is the target drive macOS will boot from.
  8. The re-install process will begin. This may take some time due to your internet speed.

When done you will setup macOS as you normally do. Enjoy!