Set Up Valet on macOS for Local WordPress Development
This is a guide on how to set up Laravel Valet on macOS for a WordPress local development environment. Using Valet as a WordPress local development solution has the main benefits of speed, being lightweight and using fewer configurations to go wrong than say a solution like Vagrant. There is a 2nd related article that…
Read MoreConverting MySQL/MariaDB database tables from MyISAM to InnoDB
The InnoDB storage engine in MySQL/MariaDB is more performant than MyISAM – here are a few ways to change that database structure, using both the command line and also some WordPress plugins. Changing from MyISAM to InnoDB via the command line If you have wp-cli installed on your webserver you can check for MyISAM tables…
Read MoreAdd and install PHP to macOS Monterey 12 with Homebrew
The latest macOS version Monterey 12 has removed PHP altogether from its operating system, there is a comment in the Apache config file httpd.conf that says: #PHP was deprecated in macOS 11 and removed from macOS 12 Fortunately you can install PHP and all the different PHP versions including 5.7, 7.4 and 8 with some…
Read MoreUpdating to PHP versions 7.4 and 8 on macOS 11 Big Sur and Catalina
The latest macOS versions of Big Sur and Catalina currently ship with PHP 7.3 and have a deprecation notice that they intend to drop support for PHP altogether in a future upgrade. You can see this by running a <? phpinfo(); ?> function in a webhosted file or running php -v on the command line.…
Read MoreInstall Apache, MySQL, PHP on macOS 11 Big Sur and earlier macOS
Get your Local Web Development Environment Up & Running on macOS Big Sur 11 and Catalina 10.15 With Apples’ new macOS Big Sur 11 available for download, here is how to get the AMP stack up and running on the new macOS. This tutorial will go through the process of getting Apache, MySQL, PHP (or…
Read MoreHow to connect to a MySQL or mariadb database with PHP
This tutorial will require a mysql database set up with a database user and password and a web development environment using mysql or mariadb, apache and php and a simple text editor. The tutorial takes you through establishing a mysql connection using php on a web page, connecting to a mysql table and retrieving the…
Read MoreAdd Copyright Symbol and Year Date in PHP
To add a copyright symbol and year date in PHP that updates with the current year, you can use the code below… © <?php echo date (‘Y’); ?> An HTML entity is used for the copyright symbol, then you have an opening PHP declaration followed by an echo, which is rendering the year using the…
Read MoreTarget WooCommerce Products and Pages Using PHP Conditionals
WooCommerce comes with a number of pages and a custom post type named ‘products‘, sometimes you may want to just target some of these products or pages so you can add some PHP custom code in your functions.php file of your theme, this can target all or parts of WooCommerce using PHP conditional statements. All WooCommerce…
Read MoreSet a conditional argument for multiple Custom Post Types in WordPress
You can set a conditional argument for multiple custom post types in WordPress using in_array The format is like so… if( in_array( get_post_type(), array( ‘treatment’, ‘package’ )) ) {//add in cpts here // do stuff } else { //what all the other post types get // do other stuff } } It searches the array of cpts…
Read MoreUsing wp_localize_script with jQuery variables including strings, booleans and integers
The use of wp_localize_script is an API in WordPress is to retrieve PHP values from the database to use in javascript/jquery scripts, it can also be utilized to make string values language translatable if required, but also used to pass user defined variables/settings say from a plugin to load via a jQuery init file for a jQuery plugin. By…
Read More