Some questions about how proper add 2 CSS file in a WordPress theme?

It seems like you’re using dependencies the opposite way of how they should be used. In the WordPress Codex, they try to explain how it’s supposed to be used. $deps (array) (optional) Array of handles of any stylesheets that this stylesheet depends on. Dependent stylesheets will be loaded before this stylesheet. Since your style2.css is … Read more

Enqueuing a stylesheet and ensuring it’s loaded before (not after) the theme’s stylesheet

By default, themes usually almost always enqueue scripts and style via the wp_enqueue_scripts hook with default priority set in add action. This is the add_action() statement by default add_action( ‘wp_enqueue_scripts’, ‘my_custom_styles_and_scripts’ ); As you can see, a priority is not set in the action, which means that it will default to 10. With this in … Read more

Custom Plugin – CSS works, JS doesn’t

Would you please try below code to your plugin page. if the script file is your plugin root directory. function plugin_adding_scripts() { wp_register_script(‘my_test_script’, plugins_url(‘testscript.js’, __FILE__), array(‘jquery’),’1.1′, true); wp_enqueue_script(‘my_test_script’); } add_action( ‘wp_enqueue_scripts’, ‘plugin_adding_scripts’ ); Also: http://blog.aztora.com/add-css-js-into-wordpress-plugin/

Scripts not loading when using the wp_enqueue_scripts action

get_stylesheet_uri() loads the main stylesheet of the theme. If you need to load additional stylesheets, you need to use get_template_directory_uri() for parent themes and get_stylesheet_directory_uri() for child themes. If you have stylesheet called custom.css in the root in a child theme, you will use get_stylesheet_directory_uri()’ . /custom.css’ You should also make sure that you have … Read more