Solution:2
Register and Enqueue Your Own Stylesheet
This is one of my favorite ways to go about overriding styles in WordPress. The idea is that you create your own stylesheet and load it into the site theme after all of the other stylesheets so that yours overrides the others.
There are two well-documented WordPress functions, one called wp_register_style() and the other wp_enqueue_style()
that allows us to do this and it can be added either to parent or child theme functions.php
file in order tell WordPress to look for it and load it in the site header.
This is a basic example of how the function can be used to call a stylesheet by the file name (aka handle) and file path:
function my-custom-styles() {
wp_register_style('custom-styles', get_template_directory_uri().'/lib/styles/custom-styles.css');
wp_enqueue_style('custom-styles');
}
add_action('wp_enqueue_scripts', 'my_custom_styles');
We could get a little more fancy by telling WordPress to load it only on a specific page:
function my_custom_styles() {
wp_register_style( 'custom-styles', get_template_directory_uri().'/lib/styles/custom-styles.css' ) );
if ( is_home() ) {
wp_enqueue_style( 'custom-styles' );
}
}
add_action( 'wp_enqueue_scripts', 'my_custom_styles' );