Troubleshooting Admin_Notice

Yup. I threw my test code in the top of the Hello Dolly plugin and there was the notice. That’s when I remembered that I was calling it within a namespace: So needed to referenced that so the WP action could access it: namespace My_Plugin; function my_mwe_admin_notice(){ echo ‘<div class=”notice notice-error”>’; echo ‘<h1>Notice this.</h1>’; echo … Read more

Hooking into the HTML header container

Unless a theme provides such a hook there is no way to do this with actions and filters. If a hook is provided then it will be theme specific, no generic WP solution exists. For a full list of the hooks that a theme should implement, see here: https://developer.wordpress.org/themes/advanced-topics/plugin-api-hooks/ At the moment this includes: wp_head() … Read more

How to change from “file_get_contents” to “wp_remote_get”

First, there is no error checking on any of the code, both the file_get_contents code, and the wp_remote_get code. Don’t just assume it worked, check! $response = file_get_contents( “http://www.geoplugin.net/json.gp?ip=” . $ip_address); if ( false === $response ) { // it failed, abort! Three steps, first, make the request: $response = wp_remote_get( $url ); Note that … Read more

Mixed content error after adding SSL certificate

You have version 1.6.0 of the crossslide plugin. (I’d guessed 1.5.2 since the changelog said 1.6.0 fixed this, but it didn’t.) You can fix this by unticking the ‘Default jQuery’ option in the plugin configuration, which removes the ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js include replacing $( with jQuery( on lines 101 and 102, i.e. instead of $(function(){ $(‘#crslideshow’).crossSlide({ you … Read more