Site logo

Archived topic

Javascript not displaying in a page

17 replies · Started by Philippe Jourdren on June 15, 2017

Viewing posts 1–15 of 18

Hi, I'm a happy blogger using GP Premium.
I try to put a javascript sequence of that type in a page :

<script language='Javascript' src='https://fr.divelogs.de/mylatestdivebig.php?user=xxxxxx' type='text/javascript'></script>

Unfortunately, nothing is displayed
Have you a clue or a solution ?
Cheers

What is the script for? Generally the it needs to go in wp_head hook.

It's for displaying an image showing a dive profile, which is hosted on divelogs.de

No it doesn't, i've installed shortcoder plugin, created a shortcode with the javascript sequence, but the shortcode doesn't work

So the shortcode doesn't output anything at all when you add it to your content?

It displays the test you see when you go the page : http://www.philjourdren.fr/carnet-de-plongees-en-ligne/

I think I must have done something wrong.
I created a shortcode called "last-dive". In the editor i copied :

<script language='Javascript' src='https://fr.divelogs.de/mylatestdivebig.php?user=lizard2802' type='text/javascript'></script>

And then I saved the shortcode. When I use it, it doesn't work

And you're adding [last-dive] to your content?

Yes !

This is just what i did ! It seems just t oreplace the text of the shortcode with the script
I don't understand what's going on !

Probably worth just creating your own shortcode.

add_shortcode( 'last_dive', 'last_dive' );
function last_dive() {
    ob_start();
    ?>
    <script language='Javascript' src='https://fr.divelogs.de/mylatestdivebig.php?user=lizard2802' type='text/javascript'></script>
    <?php
    $ret = ob_get_contents();
    ob_end_clean();
    return $ret;
}

Then use: [last_dive]

Thanks ! Do i insert this portion of code into the CSS ?

This archived topic is closed to new replies.