Unfortunately you will have to write a small plugin for this which is in my opinion, the best and cleanest and safest option. As you have already stated, it is a really bad idea changing any file in a plugin or theme that you are not the author of, and this goes for core files as well
I will tend to not go with a child theme here due to the fact that theme might be changes later and then you will have to do this all over again.
You can do something like this
-
Create a folder in your plugins folder and call it what you like
-
Create a main plugin file and call in what you want. Open it and add the following at the top of that file
<?php /* Plugin Name: NAME WHATEVER YOU LIKE */
-
Create a style.css file in your plugin folder and load all your custom styles in there
-
Next, enqueue your custom style.css. You have two options here, either use the
$dependency
parameter inwp_enqueue_style()
or simply add a$priority
to your action
Here is an example of the latter
add_action( 'wp_enqueue_scripts', 'my_custom_styles', PHP_INT_MAX );
function my_custom_styles() {
/* Register our stylesheet. */
wp_enqueue_style( 'myPluginStylesheet', plugins_url('stylesheet.css', __FILE__) );
}
Your plugin main file should look something like this
<?php
/*
Plugin Name: NAME WHATEVER YOU LIKE
*/
add_action( 'wp_enqueue_scripts', 'my_custom_styles', PHP_INT_MAX );
function my_custom_styles() {
/* Register our stylesheet. */
wp_enqueue_style( 'myPluginStylesheet', plugins_url('stylesheet.css', __FILE__) );
}