If Meta Checkbox is checked, do something?

You’re setting a value whether it’s checked or not with this line: $chk = ( isset( $_POST[‘special_box_check’] ) && $_POST[‘special_box_check’] ) ? ‘on’ : ‘off’; The value is going to be either on or off, so your if condition is always true, since it always has a value. You could change it to save only … Read more

How do I target the child theme with get_bloginfo();?

Try get_stylesheet_directory_uri(); which Retrieves stylesheet directory URI for the current theme/child theme /* == Custom Login Logo ==============================*/ function custom_login_logo() { echo ‘<style> .login h1 a { background:url(‘.get_stylesheet_directory_uri().’/images/logo-white.png) 0 0;background-size:218px 32px;height:32px;margin-bottom:10px;margin-left:20px;padding:0;width:218px } </style>’; } add_action(‘login_head’, ‘custom_login_logo’); You might need to modify the path to your image slightly depending on it’s place in your theme’s folder … Read more

WordPress errors with PhP Upgrade

Your WordPress install is out of date. Upgrading to the latest version ( 4.0.1 at time of writing ) should fix those issues, while fixing hundreds of other bugs and security issues. As a side note, you should always keep both your PHP and WordPress installs at the latest versions. Select PHP 5.4, and move … Read more

Using wp_localize_script to store the template url into a variable to use in JS

You are not enqueueing your custom JavaScript file. And calling the var (templateUrl) in JS file without the handle. Follow the following: I’m enqueueing my custom JavaScripts file (script.js) under the dependency of jQuery, so it will enqueue jQuery library from core. And I’m using the same handle my-custom-js for both my script and localize_script … Read more

Anyone can register via backend

Yes you can use following in PHP: update_option( ‘users_can_register’, $value ); Where $value can be 1 for Yes and 0 for No

How to debug php code in hostgator cPanel

PHP errors are the cause of whitescreens. You will have error logs in your Cpanel at Hostgator, but it’s much easier to use the debug logs that are available in WordPress. (For debugging outside of the WordPress environment, see http://php.net/manual/en/debugger-about.php about PHP’s own debugger and third-party debuggers). And, there are several other debugging methods you … Read more