Where to put Custom CSS ? Not working from Customizer plugin

Home Forums Legacy Support Support queries Child Themes Where to put Custom CSS ? Not working from Customizer plugin

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #127320
    devpatel
    Spectator
    Hello Team, I was customizing some short of information on the site and some important customisation so for that we added some CSS from wp-admin→ Appearance → Customizer → add Custome CSS. Its working great but now it's about more than 1000 lines of code so We are thinking to move it in any file inside the theme. So I was searched and found to add this CSS in WP-Customizer Plugin Custom.css file but after adding code to that our code is not working so please let us know how to make that code to some file inside the theme. or any other way to put that code in a separate file inside the modern theme itself.
    #127383
    H.K. Latiyan
    Participant
    Hi, In the modern theme there is a style.css file, you can add your custom css there. If you want to add the custom css in wplms customizer plugin->custom.css file then first you'll have to add the bellow code in your wplms-customizer.php file and then the css will work fine: add_action('wp_enqueue_scripts','wplms_customizer_custom_cssjs');   function wplms_customizer_custom_cssjs(){     wp_enqueue_style( 'wplms-customizer-css', plugins_url( 'css/custom.css' , __FILE__ ));     wp_enqueue_script( 'wplms-customizer-js', plugins_url( 'js/custom.js' , __FILE__ )); }
    #127487
    devpatel
    Spectator
    This reply has been marked as private.
    #127494
    devpatel
    Spectator
    This reply has been marked as private.
    #127546
    H.K. Latiyan
    Participant
    Hi, This code has no errors it just includes the files in the website. Please try to copy the code in a notepad first and the copy the code from the notepad and then paste it in the plugin file. This process will remove any html content which was copied with the code. Let me know if this helps.
    #127998
    devpatel
    Spectator
    This reply has been marked as private.
    #128132
    H.K. Latiyan
    Participant
    Hi, You said that this works on your staging website, this means that the code is correct. This means the issue could be either you are not adding the code correctly in your live website or the function is already defined in your website. To avoid the same function name in your website try adding the bellow code instead: add_action('wp_enqueue_scripts',function(){ wp_enqueue_style( 'wplms-customizer-css2', plugins_url( 'css/custom.css' , __FILE__ )); wp_enqueue_script( 'wplms-customizer-js2', plugins_url( 'js/custom.js' , __FILE__ )); });  
    #128183
    devpatel
    Spectator
    Thanks Mate, That is working for me :).
Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Where to put Custom CSS ? Not working from Customizer plugin’ is closed to new replies.