Minor bug – E-Z fix
-
Hello!
Thank you for creating this wonderful plugin. It has helped us a lot.
But I discovered a minor bug in the way that plugin path and URL is determined in the plugin.When loading WP Admin we get a lot of 404’s and the files that are “missing” belongs to this plugin. The reason is that the URL to the plugin-folder is not correct. That is because we run WP from a subdirectory, and this plugin does not seem to support that.
Solutions:
define( 'CFT_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); define( 'CFT_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );Just add these constants to the top of the file “custom-field-template.php” and use them whenever you need to use the plugin URL or path.
The inclusion of datePicker.css would then look something like this:
echo '<link rel="stylesheet" type="text/css" href="' . CFT_PLUGIN_URL . '/js/datePicker.css" />'."\n";I’ve created a diff-view which hopefully makes it more clear: https://www.diffchecker.com/BkpgjIn5.
Furthermore I would really recommend to use the function wp_enqueue_style instead when including styles. The same goes for scripts with the function wp_enqueue_script.
It would be so great if this change could be implemented as it helps the plugin become more versatile and work better with Bedrock/Sage-based install which use Composer to install WP in a sub-directory.
Kind regards,
Robert Sæther.
The topic ‘Minor bug – E-Z fix’ is closed to new replies.