[Resolved] Using custom function in child theme

Home Forums Support [Resolved] Using custom function in child theme

Home Forums Support Using custom function in child theme

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #153337
    Bob

    Hi,

    I use my function to load my css file

    add_action( 'wp_enqueue_scripts', 'my_styles' );
    function my_styles() {
       $subdb = array_shift((explode(".",$_SERVER['HTTP_HOST'])));
       wp_enqueue_style( $subdb, get_stylesheet_directory_uri().'/'. $subdb .'.css' );
    }

    but it’s loaded above the generate-style-inline-css.css link tag, so I can’t overwrite the default style without !important, is this normal custom style appears above generate-style-inline-css.css ? how to make it loaded last?

    #153351
    Tom
    Lead Developer
    Lead Developer

    Add a priority to your action:

    add_action( 'wp_enqueue_scripts', 'my_styles', 999 );

    That should do it πŸ™‚

    #153352
    Bob

    ahh thanks, this is a wordpress questions, sorry πŸ˜€

    #153362
    Tom
    Lead Developer
    Lead Developer

    No worries πŸ™‚

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.