Home > Net >  How to block wordpress theme css from overwrite my custom css from static site
How to block wordpress theme css from overwrite my custom css from static site

Time:09-27

running wordpress in docker on apache2 - webroot is /var/www/html/

my static site contains ./css/style.css and ./css/bootstrap.min.css and other ./js and ./lib in the webroot via index.html

I put wordpress in /var/www/html/wpress and pointed WordPress Address (URL) & Site Address (URL) to http://localhost/wpress

in wordpress I created a custom form which I want to integrate in my static site so far everything works like expected.

I tried via iFrame like <iframe src="http://localhost/wpress/form/" scrolling="yes" style="height:800px;width:100%; display: block; border-style:none; margin: auto; text-align: center;" frameBorder="0"></iframe> but the result gave me more problems with double scrollbar etc.

I found https://stackoverflow.com/a/34111610 as the answer with <?php print file_get_contents("http://localhost/wpress/form")?> to work like expected when cp index.html to index.php

Problem: wordpress themes ./wpress/wp-content/themes/foobar/assets/css/bootstrap.css is now used and overwrite my color scheme and other customization defined in my index.php

Question: is there a way like .htaccess entry or else to block or ignore the wordpress css from overwriting my primary css?

Edit: I deleted ./wpress/wp-content/themes/foobar/assets/css/bootstrap.css and it works. Anyway, a more cleaner way for this? Without modifying wp_enqueue_style or else?!

CodePudding user response:

You can deregister style, pass id here, which can be found on view source of that css

wp_dequeue_style( 'original-enqueue-stylesheet-handle' );
    wp_deregister_style( 'original-register-stylesheet-handle' );
  • Related