Posts

Showing posts from 2016

Disable File Editting in Wordpress Admin Area

It's recommended to disable the File Editor option under Appearances in your Wordpress Admin area by adding these lines to your wp-config.php file /** Disable File Editting within Wordpress */ define('DISALLOW_FILE_EDIT', true);

Password Protect Wordpress Admin folder from the Server's side

1. Create your .htpasswd file by running the following command: htpasswd -c /home/brendan/public_html/.htpasswd your_desired_username (where you should change "your_desired_username" with the actual username that you want to use) 2. With the .htpasswd file now created under your /home/brendan/public_html/ directory, you can go ahead and add the password protection to your wp-login.php file. You can do this by adding the following rules to the .htaccess file in /home/brendan/public_html/: <Files wp-login.php> AuthUserFile /home/brendan/public_html/.htpasswd AuthName "Private access" AuthType Basic require valid-user </Files> 3. Then create a new .htaccess file in your /home/brendan/public_html/wp-admin/ directory and put the following lines in it: AuthUserFile /home/brendan/public_html/.htpasswd AuthName "Private access" AuthType Basic require valid-user <Files admin-ajax.php>   Order allow,deny   Allow from all  

How to add links to Javascript files in Wordpress Child Theme using wp_enqueue_script

Took some to figure this out. In your "functions.php" file in your child theme directory add this code function wpb_adding_scripts() { if (!is_admin()) { wp_register_script('my_amazing_script', get_stylesheet_directory_uri() . '/js/scroller.js', array('jquery'),'1.1', true); wp_enqueue_script('my_amazing_script'); } } add_action( 'wp_enqueue_scripts', 'wpb_adding_scripts' ); This function checks that you are not logged in as an administrator. my_amazing_script can be named anything you like get_stylesheet_directory_uri() is important if you're doing this in your child theme functions.php file 1.1 is your version number and can be anything true is to load the JS file at the bottom of the page, false is to load the JS file at the top of the page