WordPress.org

Forums

Trying to hack a pixelating slideshow script to work with WordPress (1 post)

  1. fizzyfozzy
    Member
    Posted 4 years ago #

    Ok, I've tried looking for a plugin that will do this job but with no luck so i'm now trying to hack the script I have used before on non WP sites to do what i need...

    The script is this one: http://www.dynamicdrive.com/dynamicindex14/pixelate.htm

    So I have written a function as follows:

    function sponsor_slide() { ?>
        <script language="JavaScript1.1">
    		<!--
    		//Pixelating Image slideshow
    		//Copyright Dynamic Drive 2001
    		//Visit http://www.dynamicdrive.com for this script
    		//specify interval between slide (in mili seconds)
    		var slidespeed=3000
    		//specify images
    		var slideimages=new Array(<?php
    		$sponsorslide_query = new WP_Query("category_name=sponsors&posts_per_page=20");
    		if ($sponsorslide_query->have_posts()) : while ($sponsorslide_query->have_posts()) : $sponsorslide_query->the_post();?>"<?php
    			echo wp_get_attachment_thumb_url( get_post_thumbnail_id( $post->ID ) );?>",<?php
       		endwhile;
    		endif;
    		wp_reset_query();
    		?>)
    		//specify corresponding links
    		var slidelinks=new Array(<?php
    		$sponsorslide2_query = new WP_Query("category_name=sponsors&posts_per_page=20");
    		if ($sponsorslide2_query->have_posts()) : while ($sponsorslide2_query->have_posts()) : $sponsorslide2_query->the_post();?>"<?php
    			the_permalink();?>",<?php
         	endwhile;
    	 	endif;
    		wp_reset_query();
    		?>)
    		var imageholder=new Array()
    		var ie55=window.createPopup
    		for (i=0;i<slideimages.length;i++){
    		imageholder[i]=new Image()
    		imageholder[i].src=slideimages[i]
    		}
    		function gotoshow(){
    			window.location=slidelinks[whichlink]
    		}
    		//-->
    	</script>
    <?php }
    add_action ('wp_head', 'sponsor_slide');

    Which as you can see is the HEAD code from DD with some WP_query codes in the places where the images and link references need to be.

    It doesn't obviously error... but it doen't work either. It is including the javascript but just ignoring all my WP Queries.

    Can anyone offer any pointers as to where i need to go with this?

Topic Closed

This topic has been closed to new replies.

About this Topic