{"id":1612,"date":"2010-04-22T15:45:19","date_gmt":"2010-04-22T20:45:19","guid":{"rendered":"http:\/\/www.agaveweb.com\/blog\/?p=1612"},"modified":"2010-04-22T15:45:19","modified_gmt":"2010-04-22T20:45:19","slug":"random-photo-slider-miniproject","status":"publish","type":"post","link":"https:\/\/agaveweb.com\/blog\/random-photo-slider-miniproject\/","title":{"rendered":"Random photo slider miniproject"},"content":{"rendered":"<p><strong>In brief:<\/strong><\/p>\n<p>Look it: <a href=\"https:\/\/agaveweb.com\/photos\/archives\/slideshow-page\/#top\">25 random images from my photoblog slideshow<\/a><\/p>\n<p><strong>Mind you:<\/strong><\/p>\n<p>It doesn&#8217;t work in Chrome or Safari (and probably others&#8230;), some images will break (cos they&#8217;re too big to be resized), some are pixelated (cos they were too small), some aren&#8217;t cropped well (cos they&#8217;re square or portrait), and the idea is you have a fairly large monitor to see them properly in the first place.<\/p>\n<p><strong>Techyish stuff<\/strong><\/p>\n<p>Not sure if this is of interest to anyone at all but I thought I&#8217;d post it anyway&#8230; I&#8217;m coming up to the 300th photo on my <a href=\"http:\/\/agaveweb.com\/photos\/\">photoblog<\/a> (and just hit 13,500 on <a href=\"http:\/\/flickr.com\/photos\/g_w_y_n\/\">Flickr<\/a>&#8230;) I&#8217;d have more on there but it takes 10 minutes or so for each new post and I&#8217;ve been wondering for a while if there&#8217;s a way to do it with the <a href=\"http:\/\/www.darrenhoyt.com\/2008\/04\/02\/timthumb-php-script-released\/\">tim-thumb.php script<\/a> rather than using WordPress&#8217; in-built resizing tool and custom fields. Anyway, that&#8217;s an issue for another day which, using what I learnt today, should be fairly simple.<\/p>\n<p>So I wanted it to slide from one post to the next rather than load a whole new page. I&#8217;ve made inroads today.<\/p>\n<p>It uses:<\/p>\n<ul>\n<li>jQuery + jFlow for the slider: <a href=\"http:\/\/plugins.jquery.com\/project\/jFlow\">http:\/\/plugins.jquery.com\/project\/jFlow<\/a><\/li>\n<li>A new variable for the WP Loop I&#8217;d not heard of before: &#8216;<a href=\"http:\/\/codex.wordpress.org\/Function_Reference\/query_posts#Orderby_Parameters\">orderby=rand<\/a>&#8216;<\/li>\n<li>substr &#8211; a php command that lops a given number of characters off a string (such as the URL of the photo), then concatenates the tim-thumb resizing bit on the end.<\/li>\n<\/ul>\n<p><code> <\/p>\n<div id=\"slides\">\n  <?php $category = wp_get_object_terms($main_query->post->ID, 'category');<br \/>\n  $recent = new WP_Query(\"showposts=25&orderby=rand\"); while($recent->have_posts()) : $recent->the_post();?><\/p>\n<div>\n  &lt;a href=\"<?php the_permalink(); ?>\"> <img decoding=\"async\" src=\"http:\/\/agaveweb.com\/photos\/wp-content\/themes\/blackcanvas_10\/timthumb.php?src=<?php \n\t$string = get_post_meta($post->ID, \"photo\", true);<br \/>\n$newstring = substr($string, 0, -12).'.jpg';<br \/>\n\techo $newstring; ?>&h=750&w=950&zc=1\" alt=\"<?php the_title(); ?>\" \/> <\/a><\/p>\n<p class=\"slider\">\n      <?php the_title(); ?>\n    <\/p>\n<\/p><\/div>\n<p>  <?php endwhile; ?>\n<\/div>\n<p><\/code><\/p>\n<p>And <em>that<\/em> is what passes for excitement during the week in Brunswick, Maine.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In brief: Look it: 25 random images from my photoblog slideshow Mind you: It doesn&#8217;t work in Chrome or Safari (and probably others&#8230;), some images will break (cos they&#8217;re too big to be resized), some are pixelated (cos they were too small), some aren&#8217;t cropped well (cos they&#8217;re square or portrait), and the idea is&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":""},"categories":[5,14],"tags":[26,25],"class_list":["post-1612","post","type-post","status-publish","format-standard","hentry","category-blogging-about-blogging","category-photography","tag-slider","tag-wordpress"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Random photo slider miniproject - Gwyn&#039;s Blog<\/title>\n<meta name=\"description\" content=\"In brief: Look it: 25 random images from my photoblog slideshow Mind you: It doesn&#039;t work in Chrome or Safari (and probably others...), some images will - Random photo slider miniproject\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/agaveweb.com\/blog\/random-photo-slider-miniproject\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Random photo slider miniproject - Gwyn&#039;s Blog\" \/>\n<meta property=\"og:description\" content=\"In brief: Look it: 25 random images from my photoblog slideshow Mind you: It doesn&#039;t work in Chrome or Safari (and probably others...), some images will - Random photo slider miniproject\" \/>\n<meta property=\"og:url\" content=\"https:\/\/agaveweb.com\/blog\/random-photo-slider-miniproject\/\" \/>\n<meta property=\"og:site_name\" content=\"Gwyn&#039;s Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/gwyn.fisher\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/gwyn.fisher\" \/>\n<meta property=\"article:published_time\" content=\"2010-04-22T20:45:19+00:00\" \/>\n<meta name=\"author\" content=\"Gwyn Fisher\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@gwynf\" \/>\n<meta name=\"twitter:site\" content=\"@gwynf\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Gwyn Fisher\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/agaveweb.com\\\/blog\\\/random-photo-slider-miniproject\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/agaveweb.com\\\/blog\\\/random-photo-slider-miniproject\\\/\"},\"author\":{\"name\":\"Gwyn Fisher\",\"@id\":\"https:\\\/\\\/agaveweb.com\\\/blog\\\/#\\\/schema\\\/person\\\/caea4297cc7ec7568667598a8432fe7b\"},\"headline\":\"Random photo slider miniproject\",\"datePublished\":\"2010-04-22T20:45:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/agaveweb.com\\\/blog\\\/random-photo-slider-miniproject\\\/\"},\"wordCount\":274,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/agaveweb.com\\\/blog\\\/#\\\/schema\\\/person\\\/caea4297cc7ec7568667598a8432fe7b\"},\"keywords\":[\"slider\",\"wordpress\"],\"articleSection\":[\"Blogging about blogging\",\"Photography\"],\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/agaveweb.com\\\/blog\\\/random-photo-slider-miniproject\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/agaveweb.com\\\/blog\\\/random-photo-slider-miniproject\\\/\",\"url\":\"https:\\\/\\\/agaveweb.com\\\/blog\\\/random-photo-slider-miniproject\\\/\",\"name\":\"Random photo slider miniproject - Gwyn&#039;s Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/agaveweb.com\\\/blog\\\/#website\"},\"datePublished\":\"2010-04-22T20:45:19+00:00\",\"description\":\"In brief: Look it: 25 random images from my photoblog slideshow Mind you: It doesn't work in Chrome or Safari (and probably others...), some images will - Random photo slider miniproject\",\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/agaveweb.com\\\/blog\\\/random-photo-slider-miniproject\\\/\"]}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/agaveweb.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/agaveweb.com\\\/blog\\\/\",\"name\":\"Gwyn's Blog\",\"description\":\"Instagram, but slower\",\"publisher\":{\"@id\":\"https:\\\/\\\/agaveweb.com\\\/blog\\\/#\\\/schema\\\/person\\\/caea4297cc7ec7568667598a8432fe7b\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/agaveweb.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/agaveweb.com\\\/blog\\\/#\\\/schema\\\/person\\\/caea4297cc7ec7568667598a8432fe7b\",\"name\":\"Gwyn Fisher\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/agaveweb.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/12\\\/IMG_3230-750x500.jpg\",\"url\":\"https:\\\/\\\/agaveweb.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/12\\\/IMG_3230-750x500.jpg\",\"contentUrl\":\"https:\\\/\\\/agaveweb.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/12\\\/IMG_3230-750x500.jpg\",\"width\":750,\"height\":500,\"caption\":\"Gwyn Fisher\"},\"logo\":{\"@id\":\"https:\\\/\\\/agaveweb.com\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/12\\\/IMG_3230-750x500.jpg\"},\"description\":\"Salt Lake City based Brit, into all the usual plus trail running.\",\"sameAs\":[\"https:\\\/\\\/agaveweb.com\\\/blog\",\"https:\\\/\\\/www.facebook.com\\\/gwyn.fisher\",\"https:\\\/\\\/instagram.com\\\/gwynfisher\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/gwynfisher\\\/\",\"https:\\\/\\\/x.com\\\/gwynf\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCwMyfLDeFrdr1q4KPZyGBiw\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Random photo slider miniproject - Gwyn&#039;s Blog","description":"In brief: Look it: 25 random images from my photoblog slideshow Mind you: It doesn't work in Chrome or Safari (and probably others...), some images will - Random photo slider miniproject","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/agaveweb.com\/blog\/random-photo-slider-miniproject\/","og_locale":"en_GB","og_type":"article","og_title":"Random photo slider miniproject - Gwyn&#039;s Blog","og_description":"In brief: Look it: 25 random images from my photoblog slideshow Mind you: It doesn't work in Chrome or Safari (and probably others...), some images will - Random photo slider miniproject","og_url":"https:\/\/agaveweb.com\/blog\/random-photo-slider-miniproject\/","og_site_name":"Gwyn&#039;s Blog","article_publisher":"https:\/\/www.facebook.com\/gwyn.fisher","article_author":"https:\/\/www.facebook.com\/gwyn.fisher","article_published_time":"2010-04-22T20:45:19+00:00","author":"Gwyn Fisher","twitter_card":"summary_large_image","twitter_creator":"@gwynf","twitter_site":"@gwynf","twitter_misc":{"Written by":"Gwyn Fisher","Estimated reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/agaveweb.com\/blog\/random-photo-slider-miniproject\/#article","isPartOf":{"@id":"https:\/\/agaveweb.com\/blog\/random-photo-slider-miniproject\/"},"author":{"name":"Gwyn Fisher","@id":"https:\/\/agaveweb.com\/blog\/#\/schema\/person\/caea4297cc7ec7568667598a8432fe7b"},"headline":"Random photo slider miniproject","datePublished":"2010-04-22T20:45:19+00:00","mainEntityOfPage":{"@id":"https:\/\/agaveweb.com\/blog\/random-photo-slider-miniproject\/"},"wordCount":274,"commentCount":0,"publisher":{"@id":"https:\/\/agaveweb.com\/blog\/#\/schema\/person\/caea4297cc7ec7568667598a8432fe7b"},"keywords":["slider","wordpress"],"articleSection":["Blogging about blogging","Photography"],"inLanguage":"en-GB","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/agaveweb.com\/blog\/random-photo-slider-miniproject\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/agaveweb.com\/blog\/random-photo-slider-miniproject\/","url":"https:\/\/agaveweb.com\/blog\/random-photo-slider-miniproject\/","name":"Random photo slider miniproject - Gwyn&#039;s Blog","isPartOf":{"@id":"https:\/\/agaveweb.com\/blog\/#website"},"datePublished":"2010-04-22T20:45:19+00:00","description":"In brief: Look it: 25 random images from my photoblog slideshow Mind you: It doesn't work in Chrome or Safari (and probably others...), some images will - Random photo slider miniproject","inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/agaveweb.com\/blog\/random-photo-slider-miniproject\/"]}]},{"@type":"WebSite","@id":"https:\/\/agaveweb.com\/blog\/#website","url":"https:\/\/agaveweb.com\/blog\/","name":"Gwyn's Blog","description":"Instagram, but slower","publisher":{"@id":"https:\/\/agaveweb.com\/blog\/#\/schema\/person\/caea4297cc7ec7568667598a8432fe7b"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/agaveweb.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":["Person","Organization"],"@id":"https:\/\/agaveweb.com\/blog\/#\/schema\/person\/caea4297cc7ec7568667598a8432fe7b","name":"Gwyn Fisher","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/agaveweb.com\/blog\/wp-content\/uploads\/2018\/12\/IMG_3230-750x500.jpg","url":"https:\/\/agaveweb.com\/blog\/wp-content\/uploads\/2018\/12\/IMG_3230-750x500.jpg","contentUrl":"https:\/\/agaveweb.com\/blog\/wp-content\/uploads\/2018\/12\/IMG_3230-750x500.jpg","width":750,"height":500,"caption":"Gwyn Fisher"},"logo":{"@id":"https:\/\/agaveweb.com\/blog\/wp-content\/uploads\/2018\/12\/IMG_3230-750x500.jpg"},"description":"Salt Lake City based Brit, into all the usual plus trail running.","sameAs":["https:\/\/agaveweb.com\/blog","https:\/\/www.facebook.com\/gwyn.fisher","https:\/\/instagram.com\/gwynfisher\/","https:\/\/www.linkedin.com\/in\/gwynfisher\/","https:\/\/x.com\/gwynf","https:\/\/www.youtube.com\/channel\/UCwMyfLDeFrdr1q4KPZyGBiw"]}]}},"taxonomy_info":{"category":[{"value":5,"label":"Blogging about blogging"},{"value":14,"label":"Photography"}],"post_tag":[{"value":26,"label":"slider"},{"value":25,"label":"wordpress"}]},"featured_image_src_large":false,"author_info":{"display_name":"Gwyn Fisher","author_link":"https:\/\/agaveweb.com\/blog\/author\/gwyn\/"},"comment_info":0,"category_info":[{"term_id":5,"name":"Blogging about blogging","slug":"blogging-about-blogging","term_group":0,"term_taxonomy_id":5,"taxonomy":"category","description":"","parent":0,"count":31,"filter":"raw","cat_ID":5,"category_count":31,"category_description":"","cat_name":"Blogging about blogging","category_nicename":"blogging-about-blogging","category_parent":0},{"term_id":14,"name":"Photography","slug":"photography","term_group":0,"term_taxonomy_id":16,"taxonomy":"category","description":"","parent":0,"count":1767,"filter":"raw","cat_ID":14,"category_count":1767,"category_description":"","cat_name":"Photography","category_nicename":"photography","category_parent":0}],"tag_info":[{"term_id":26,"name":"slider","slug":"slider","term_group":0,"term_taxonomy_id":29,"taxonomy":"post_tag","description":"","parent":0,"count":1,"filter":"raw"},{"term_id":25,"name":"wordpress","slug":"wordpress","term_group":0,"term_taxonomy_id":28,"taxonomy":"post_tag","description":"","parent":0,"count":1,"filter":"raw"}],"_links":{"self":[{"href":"https:\/\/agaveweb.com\/blog\/wp-json\/wp\/v2\/posts\/1612","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/agaveweb.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/agaveweb.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/agaveweb.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/agaveweb.com\/blog\/wp-json\/wp\/v2\/comments?post=1612"}],"version-history":[{"count":0,"href":"https:\/\/agaveweb.com\/blog\/wp-json\/wp\/v2\/posts\/1612\/revisions"}],"wp:attachment":[{"href":"https:\/\/agaveweb.com\/blog\/wp-json\/wp\/v2\/media?parent=1612"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/agaveweb.com\/blog\/wp-json\/wp\/v2\/categories?post=1612"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/agaveweb.com\/blog\/wp-json\/wp\/v2\/tags?post=1612"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}