You have two flaws in your code, one is a syntax error, the other one is the wrong hook.
Firstly, wp_enqueue_scripts
is the hook used to enqueue scripts and styles for front end use. When you need to enqueue scripts and styles for the backend, you should use the admin_enqueue_scripts
hook
Secondly, you are missing a /
in your file path
wp_register_script( 'virtual-script', plugins_url('js/virtual-script.js', __FILE__));
should be
wp_register_script( 'virtual-script', plugins_url('/js/virtual-script.js', __FILE__));
There is also some piece of code (*/
) that doesn’t belong in this line
wp_register_style('virtual-css',plugins_url('css/virtual.css',__FILE__));*/
This line should be
wp_register_style('virtual-css',plugins_url('/css/virtual.css',__FILE__));
I’m not sure if you are doing this in a class, but if you are not this array(&$this,'register_scripts_styles'
is not necessary, you can just simply use 'register_scripts_styles'
One last tip that you should consider when writing themes and plugins, is to use the build in debugging tool in wordpress. Most problems that you have should show up in debug. It also makes it easier to find a problem in a piece of code. Go and read through Debugging WordPress
Also take @bueltge comment into consideration here