Converting MySQL/MariaDB database tables from MyISAM to InnoDB

Myisam Convert Innodb Storage Engine Wordpress

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 More

Add Copyright Symbol and Year Date in PHP

Php Copyright Year

To add a copyright symbol and year date in PHP that updates with the current year, you can use the code below… &copy; <?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 More

Set a conditional argument for multiple Custom Post Types in WordPress

cpts-conditionals

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 More

Using wp_localize_script with jQuery variables including strings, booleans and integers

set a jquery value via wp-localize-script

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