Categories
PHP Wordpress

Load / Enqueue the latest version of css and javascript files

Add the following code to your functions.php file to load or enqueue the most recent child theme style.css file or any css/javascript file.

function my_custom_files() {

  //use the current date and time as the file version
  $cache_buster = date("YmdHi");
  
  wp_register_style( 'childstyle', get_stylesheet_directory_uri() . '/style.css', $cache_buster, 'all'  );
  wp_enqueue_script( 'my-scripts', get_stylesheet_directory_uri() . '/scripts.js', array(), $cache_buster, true );
  wp_enqueue_style( 'childstyle' );

}
add_action( 'wp_enqueue_scripts', 'my_custom_files', 11);
Categories
Blog Wordpress

Two Simple Tips to Securing Your WordPress Site

1. Never use the default ‘admin’ as your administrator login username. As it is the default, unauthorized parties trying to wrongfully access your site will attempt using ‘admin’ to log in. Changing the username to something, anything other than ‘admin’ will prevent malicious attacks.

2. Add a Captcha Code. A Captcha (a backronym for “Completely Automated Public Turing test to tell Computers and Humans Apart”) is a type of challenge-response test used in computing to determine whether or not the user is human.

Usually, the Captcha test will take the form of a random set of characters shown on an image which the user has to type in an accompanying input box. Other cool captcha tests will ask the user to sum two numbers or click a checkbox proving that they’re human. There are several types of captcha tests available to check for bots which may attempt to hack your site.

Recently, I’ve had the pleasure of using the Captcha Bank plugin for WordPress – its pretty impressive. It adapted seemlessly to a specially customized login page when other Captcha plugin wouldn’t. There are lots of various options for customizing the Captcha code.