Note that there are some explanatory texts on larger screens.

plurals
  1. POWordpress Plugin and Jquery
    text
    copied!<p>I am trying to create a gallery through a plugin I am making but am getting a javascript error and cant figure out why. Below is my code any help would be greatly appreciated. Here is where I have implemented it. <a href="http://findlegalanswers.com/?page_id=4" rel="nofollow noreferrer">http://findlegalanswers.com/?page_id=4</a></p> <pre><code>&lt;?php /* Plugin Name: iPad and iPhone Swipe Gallery Version: 1.0 Plugin URI: http://www.prototypesyndicate.com Description: Adds a great simple looking gallery to your pages or post with iPhone and iPad swipe. For more information on how to setup view documentation in plugin folder Author: Alex Gonzalez - Vinas Author URI: http://www.prototypesyndicate.com */ function jquery_load_gallery_header() { echo "&lt;script src=\"http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js\" type=\"text/javascript\"&gt;&lt;/script&gt;" . "\n"; echo "&lt;script src=" . get_bloginfo('wpurl') . "/wp-content/plugins/iPad_iPhone_Gallery/js/jquery.touch-gallery-1.0.0.js\"&gt;&lt;/script&gt;" . "\n"; } function simpleslide_load_ready() { echo "&lt;style type=\"text/css\"&gt; #content { padding: 50px 0 0 0; width: 600px; } #gallery { width: 300px; overflow: hidden; } #gallery div, #gallery a { display: block; float: left; color: #fff; width: 75px; height: 75px; margin: 0 8px 8px 0; } &lt;/style&gt;"; } add_action('wp_head', 'jquery_load_gallery_header'); add_action('wp_head', 'simpleslide_load_ready'); //album [album category="flickr_url"] [/album] function mAlbum( $atts, $content = null ) { extract( shortcode_atts( array( 'flickr' =&gt; 'Featured', ), $atts ) ); ob_start(); ?&gt; &lt;div id="content"&gt; &lt;div id="gallery"&gt; &lt;/div&gt; &lt;/div&gt; &lt;script&gt; $(function() { $.getJSON("http://api.flickr.com/services/rest?method=flickr.photosets.getPhotos&amp;api_key=ed144a125aca366df3438c58c0c0ec9d&amp;photoset_id=72157624601158052&amp;extras=url_sq,url_m,url_o,&amp;format=json&amp;jsoncallback=?", function(data) { $.each(data.photoset.photo, function(i) { $('&lt;div&gt;').append($('&lt;img&gt;').attr('src', this.url_sq)).data('flickr', this).appendTo('#gallery'); }); $('#gallery div').touchGallery({ getSource: function() { var f = $(this).data('flickr'); return f.url_o || f.url_sq.replace('_s.', '_b.'); } }); }); }); &lt;/script&gt; &lt;?php $content = ob_get_contents(); ob_end_clean(); return $content; } // Adds shortcode to use in pages or post. add_shortcode('album', 'mAlbum'); ?&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload