How can remove your css with id “ws-plugin–s2member-css” ?
how you can add this css?
thanks
How can remove your css with id “ws-plugin–s2member-css” ?
how you can add this css?
thanks
i cannot overwrite your css with theme style css. I set priority 100 in my hooks wp_enqueue_scripts but you use init hook for generate css, init hook fire BEFORE wp_enqueue_scripts…
Why you don’t use the appropriate hook???
WHY???
???
I think it’s you who is using the wrong hook. You don’t enqueue CSS with wp_enqueue_script
(note: it’s also singular, not plural). That is for enqueuing javascript.
You enqueue CSS with wp_enqueue_style
. I use that and have no trouble overriding s2Member’s styles.
I use the correct hook (note the finaly S), my assets load correctly and have 100 priority. But load before the s2member php style, see below.
`
`I resolved in this way
before remove action (s2member action) : remove_action('wp_print_styles', 'c_ws_plugin__s2member_css_js_themes::add_css', 10);
then add style to wp_enqueue_scripts: add_action('wp_enqueue_scripts', 'c_ws_plugin__s2member_css_js_themes::add_css', 10);
and them i add theme style with priority 15 so load AFTER s2member style.
What a convoluted process!
So you come on here to berate others for not doing this correctly, when you yourself are the culprit.
You shouldn’t be adding <link>
to the head. As I said, you should be enqueuing your CSS using wp_enqueue_style
: https://developer.wordpress.org/reference/functions/wp_enqueue_style/
As I also pointed out, there is a similar method for enqueuing javascript.
When you follow the WordPress Codex, you’ll find it all works quite smoothly.
You don’t understand, and i don’t write well english.
What you see on my reply is the html output, not what i do…i cannot put <link>
directly on header.php.
My last comment is the solution. In functions.php:
remove_action('wp_print_styles', 'c_ws_plugin__s2member_css_js_themes::add_css', 10);
then add add_action('wp_enqueue_scripts', 'c_ws_plugin__s2member_css_js_themes::add_css', 10);
and set higher pririoty into wp_enqueue_scripts
that enqueue styles theme. OR alternative set higher pririority on
add_action('wp_enqueue_scripts', 'c_ws_plugin__s2member_css_js_themes::add_css', 20);
bye
OK, we were at cross purposes. Glad you got it working!