The social network button you posted comes in two distinct parts.
First, the button itself is defined by the anchor tag.
<a href="http://svejo.net/submit/?url=[your url]"
data-url="[your url]"
data-type="compact"
id="svejo-button">Add in Svejo</a>
Then, presumably the script replaced that button with an iframe or something similar so you don’t have to send your users elsewhere to get it work work.
<script type="text/javascript" src="http://svejo.net/javascripts/svejo-button.js"></script>
The first part, the anchor tag, should go in your single.php
file, and probably look something like this:
<a href="http://svejo.net/submit/?url=<?php the_permalink(); ?>"
data-url="<?php the_permalink(); ?>"
data-type="compact"
id="svejo-button">Add in Svejo</a>
That’s not going to slow down your load time. Next you can use wp_enqueue_script
in your functions.php
file. Here we’ll hook into wp_enqueue_scripts
and enqueue our script inside our hooked function.
<?php
add_action( 'wp_enqueue_scripts', 'wpse29581_print_scripts' );
function wpse29581_print_scripts()
{
wp_enqueue_script( 'svejo-wpse29581', 'http://svejo.net/javascripts/svejo-button.js', array(), NULL, true );
}
The last argument of wp_enqueue_script
tells WordPress to load the script in the footer. This will help keep the script from holding up the page load.
We can make this function a bit better, however, by checking to see if we’re on a single post page and only enqueue the script if we are. Only load scripts if they’re needed.
<?php
add_action( 'wp_print_scripts', 'wpse29581_print_scripts' );
function wpse29581_print_scripts()
{
// if this isn't a single post page, bail
if( ! is_single() ) return;
wp_enqueue_script( 'svejo-wpse29581', 'http://svejo.net/javascripts/svejo-button.js', array(), NULL, true );
}
That would be the proper way to use wp_enqueue_script
in this case. I think you’re a bit confused as to how it works.