Hi! i added to custom ad 2 the following code:
<script type=”text/javascript”> var imagen = new Array(); var enlace = new Array();
//
// ANUCIO PROVINCIALES
// Ya supondrás que un par (imagen y enlace) por cada anuncio.
//imagen[0] = “http://weekenjoy.com/wp-content/uploads/2018/05/blup-1.gif”;
enlace[0] = “https://www.facebook.com/bluphelado/”;//
// A partir de aquí el restro del programa.
var xy; do { xy = Math.floor(Math.random()*imagen.length); } while(xy==window.ANUNCIO_ANTERIOR); window.ANUNCIO_ANTERIOR = xy; var img_width = “300”; var img_height = “250”; var img_title = “Visita el sitio web”; document.write(‘‘);
</script>
This code allow me to use random pics that i use so in that way i can use local ads. If you go to the home http://www.weekenjoy.com the web loads heavy but loads… however if you want inside a post, the web never loads and it freeze the window. I tried to use another light image but that is not the problem, even if i use the script without images the posts freeze completely… Please, how can i use this script in my entire web without problems.
<script type=”text/javascript”> var imagen = new Array(); var enlace = new Array();
//
// ANUCIO PROVINCIALES
// Ya supondrás que un par (imagen y enlace) por cada anuncio.
//
imagen[0] = “http://weekenjoy.com/wp-content/uploads/2018/05/blup-1.gif”;
enlace[0] = “https://www.facebook.com/bluphelado/”;
//
// A partir de aquí el restro del programa.
var xy; do { xy = Math.floor(Math.random()*imagen.length); } while(xy==window.ANUNCIO_ANTERIOR); window.ANUNCIO_ANTERIOR = xy; var img_width = “300”; var img_height = “250”; var img_title = “Visita el sitio web”; document.write(‘‘);
</script>
posted again for a better view
-
This reply was modified 8 years by
vargaspazdaniel.
i deleted the js in custom ad2 because the website is unusable with that script…
Hi,
Indeed, loading some scripts in the theme ad spot section will cause problems. There have been cases where some scripts caused the images on the whole website to not display.
When this happens there would be no solution except to modify the ad code if possible, or use a different one.
However i have another website with Newspaper 8 with older version and in this didn’t happens never… It’s the same version how can be this possible? Newspaper 8 is prepared to use custom ads, i don’t see any reason to work properly with custom ads in homepage but not in posts… This is clearly a problem of the theme and lastest updates…
From what I can see the moment that ad code and script is loaded in the website, and the post content is loaded as well eventually
– https://www.screencast.com/t/idLSwKpA7d
But it is loading very bad, at least the post I tested. Seems you use some kind of gallery implementation or plugin to display images. These images that are served to users are quite big, the post I tested took 5 minutes to load fully and transferred a total of 183 MB content, which would be a very long time and enormous page size
– https://www.screencast.com/t/9m5gYWTUEW
yes finally i fixed the problem with that ad.
That page is an old post and the new ones are images very very tiny… Any suggestion to improve the results with this kind of post that are fully images of gallery?
Best to use smaller images if possible, or thumbnails of them
– https://www.screencast.com/t/QJjwJHA0Sw1w
Also check online image optimization guides and tutorials, there are plenty
– https://www.wpexplorer.com/optimize-images-wordpress-guide/
– https://cyberchimps.com/guide/optimize-images-for-wordpress/
Thanks, you can close this ticket. The problem with the script was a ” missed at the end of the image link (imagen[0])