0

I looked at this question:

plugin css is not being applied to the page?

but I couldnt solve my problem.

I use below code like the question:

 <?php
                    function libload()
                    {
                    wp_register_style( 'foo-styles',  plugin_dir_url( __FILE__ ) . 'dahili/bootstrap.min.css' );
                    wp_enqueue_style( 'foo-styles' );

                    wp_register_style( 'foo-styles2',  plugin_dir_url( __FILE__ ) . 'dahili/style.css' );
                    wp_enqueue_style( 'foo-styles2' );

                    wp_register_style( 'foo-styles3',  plugin_dir_url( __FILE__ ) . 'dahili/responsive.css' );
                    wp_enqueue_style( 'foo-styles3' );

                    }
                    add_action('wp_enqueue_scripts','libload');
                  ?>

style files are loading as you can see below link but wp not apply them:

http://www.hekim.deniz-tasarim.site/sample-page/

How can I solve this problem?

2
  • 1
    No, the style files are not loading. If you view your source, those files aren't listed. What file is your code running in? Is the plugin active?
    – WebElaine
    Apr 13, 2020 at 18:38
  • @WebElaine yes, plugin is active.I need all css files Apr 13, 2020 at 18:41

2 Answers 2

0

Your code looks correct, but the page you linked to doesn't seem to have them included.

This means that this line is not being run:

add_action('wp_enqueue_scripts','libload');

Check if the php file that you have it inside of is included by one of your plugin files?

Or that you are trying to include a file with the wrong path.

Check that the file is in a plugin not a theme folder, or you will need a different path.

1
  • I solved it like this : <?php wp_register_style( 'foo-styles', plugin_dir_url( FILE ) . 'dahili/bootstrap.min.css' ); wp_enqueue_style( 'foo-styles' ); wp_register_style( 'foo-styles2', plugin_dir_url( FILE ) . 'dahili/style.css' ); wp_enqueue_style( 'foo-styles2' ); wp_register_style( 'foo-styles3', plugin_dir_url( FILE ) . 'dahili/responsive.css' ); wp_enqueue_style( 'foo-styles3' ); ?> Apr 13, 2020 at 18:58
0

Change integratation code with this:

  <?php
                    wp_register_style( 'foo-styles',  plugin_dir_url( __FILE__ ) . 'dahili/bootstrap.min.css' );
                    wp_enqueue_style( 'foo-styles' );

                    wp_register_style( 'foo-styles2',  plugin_dir_url( __FILE__ ) . 'dahili/style.css' );
                    wp_enqueue_style( 'foo-styles2' );

                    wp_register_style( 'foo-styles3',  plugin_dir_url( __FILE__ ) . 'dahili/responsive.css' );
                    wp_enqueue_style( 'foo-styles3' );
                  ?>
1
  • 1
    this could cause you problems down the line. You are just skipping over using the correct action hook with this code.
    – rtpHarry
    Apr 13, 2020 at 19:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.