csswordpressbackend

I'm looking for a way for my own Plugin to integrate my own CSS


Good morning

I have programmed my own WordPress plugin. But I don't like the output in the backend. For example, I want a heading not in black but in white and I want it to be larger. Since I don't want to write the styles directly into the code, I need my own CSS file. The problem is, I don't know how to integrate a CSS file into my plugin so that it makes my heading bigger in the backend. Can you give me some tips?

So far I have entered the CSS styles directly into the code. But I can't change tables created by Wordpress. For example the style table.widefat


Solution

  • you can call back your function in wordpress hook, given example below

    my-plugin is handle, its always change for entering new file plugin_url(), is wp built in function where you specify your css file directory/file-name.css

        function getdata_wp_code_in_wp_head(){
         wp_register_style( 'my-plugin', plugins_url( 'my-plugin/css/plugin.css' ) );
         wp_enqueue_style( 'my-plugin' );
        }
       add_action('wp_head' , 'getdata_wp_code_in_wp_head');
    

    you can also use the below code

    function code_head(){
      wp_enqueue_style( 'vscf_style', plugins_url('/css/vscf-style.min.css') );
    }
    add_action( 'wp_enqueue_scripts', 'code_head' );