Facebook script wp_enqueue

wordpress

#1
  1. Please use wp_enqueue to load any external scripts/stylesheet - wp_enqueue_script / wp_enqueue_style

I should add it to function.php ?

What language should I use as default ?


Soft Reject for FB and G+ script
#2

Generally, you’ll enqueue scripts and stylesheets in functions.php like this:

https://developer.wordpress.org/reference/functions/wp_enqueue_script/


#3

Thanks, I know how to enqueue script … but how to enqueue FB script ? Create php files and enqueue it ?


#4

From that screenshot I think they mean the Google platform.js. The Facebook API is called in an IIFE which I don’t think can be enqueued in the same way that that Google platform file (or other standard script links) can. It might be more appropriate to load the Facebook API like:

function yourtextdomain_facebook_api_js() {
?>

<script>(function(d, s, id) {
   // more
}(document, 'script', 'facebook-jssdk'));</script>

<?php

}
add_action('wp_head', 'yourtextdomain_facebook_api_js');

But that’s probably something to clarify with the review team.


#5

WordPress and PHP is a s… Please learn Ruby on Rails :slight_smile: