1

I have been trying to get the same code I have on my old server to work on my new server. This is the code I have thus far:

function enqueue_load_fa() {
wp_enqueue_style( 'load-fa', 'https://use.fontawesome.com/releases/v5.5.0/css/all.css' );
}

The issue I am having is that on my test site http://thedroidgamer.info/2018/11/25/hello-world/ it is not working but on my other one it is. See screenshot below: https://scrnshot.app/DfNnwwV3ba3.png

Both servers have the same exact coding. I have tried 3 servers in all and only one of them has worked, with the same code. I am not understanding why it's not being accepted at all.

3
  • That function isn't going to do anything unless you hook it with add_action(). Have you done that? Nov 25, 2018 at 10:14
  • I have this underneath that: add_action( 'wp_enqueue_style', 'enqueue_load_fa' ); add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' ); Nov 25, 2018 at 10:20
  • Some thing to note that the css is not added to your webpage ..you can check that with developer tools on your web page ..means you have made some mistake in coding..post your complete code you might have made a typo some where
    – user145078
    Nov 25, 2018 at 10:49

1 Answer 1

2

Try this,

function enqueue_load_fa() {
  wp_enqueue_style( 'load-fa', 'https://use.fontawesome.com/releases/v5.5.0/css/all.css' );
}

add_action( 'wp_enqueue_scripts', 'enqueue_load_fa');
7
  • Why should this fix anything? Could you elaborate and explain your answer? Nov 25, 2018 at 10:58
  • @KrzysiekDróżdż i think add_action( 'wp_enqueue_style', 'enqueue_load_fa' ) this was used by @thedroidgamer
    – user145078
    Nov 25, 2018 at 11:03
  • The first half of my code <?php function my_theme_enqueue_styles() { $parent_style = 'twentynineteen-style'; // This is 'twentynineteen-style' for the Twenty Nineteen theme. wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' ); wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array( $parent_style ), wp_get_theme()->get('Version') ); } Nov 25, 2018 at 11:08
  • The second half: function enqueue_load_fa() { wp_enqueue_style( 'load-fa', 'https://use.fontawesome.com/releases/v5.5.0/css/all.css' ); } add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' ); add_action( 'wp_enqueue_scripts', 'enqueue_load_fa' ); ?> Nov 25, 2018 at 11:13
  • 1
    Latheesh - you should edit your answer to explain in the answer why this would be the answer (specifically - the addition of add_action() that thedroidgamer did not use). Always give a description of "why" with the "what" and "how". It makes a better answer.
    – butlerblog
    Nov 25, 2018 at 12:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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