<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>images Archives - rweber.net</title>
	<atom:link href="https://www.rweber.net/tag/images/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.rweber.net/tag/images/</link>
	<description>trying to be a mile wide AND a mile deep</description>
	<lastBuildDate>Sun, 09 Dec 2018 13:50:54 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
<site xmlns="com-wordpress:feed-additions:1">37896774</site>	<item>
		<title>Troubleshooting Flickity: one note</title>
		<link>https://www.rweber.net/javascript/troubleshooting-flickity-one-note/</link>
					<comments>https://www.rweber.net/javascript/troubleshooting-flickity-one-note/#respond</comments>
		
		<dc:creator><![CDATA[Rebecca]]></dc:creator>
		<pubDate>Mon, 24 Aug 2015 12:00:56 +0000</pubDate>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Flickity]]></category>
		<category><![CDATA[images]]></category>
		<guid isPermaLink="false">http://www.rweber.net/?p=39155</guid>

					<description><![CDATA[<div><img width="300" height="200" src="https://www.rweber.net/wp-content/uploads/2015/08/4744428334_13c70a6165_z-300x200.jpg" class="attachment-medium size-medium wp-post-image" alt="photo of amusement park height restriction sign" style="float:left; margin-right:16px; margin-bottom:16px;" decoding="async" fetchpriority="high" srcset="https://www.rweber.net/wp-content/uploads/2015/08/4744428334_13c70a6165_z-300x200.jpg 300w, https://www.rweber.net/wp-content/uploads/2015/08/4744428334_13c70a6165_z-150x100.jpg 150w, https://www.rweber.net/wp-content/uploads/2015/08/4744428334_13c70a6165_z.jpg 640w" sizes="(max-width: 300px) 100vw, 300px" /></div>
<p>The key to Flickity is this: everything it is applied to needs to have accurate size beforehand. Here are some cases where that wasn't the case and how I fixed them.</p>
<p>The post <a href="https://www.rweber.net/javascript/troubleshooting-flickity-one-note/">Troubleshooting Flickity: one note</a> appeared first on <a href="https://www.rweber.net">rweber.net</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div><img width="300" height="200" src="https://www.rweber.net/wp-content/uploads/2015/08/4744428334_13c70a6165_z-300x200.jpg" class="attachment-medium size-medium wp-post-image" alt="photo of amusement park height restriction sign" style="float:left; margin-right:16px; margin-bottom:16px;" decoding="async" srcset="https://www.rweber.net/wp-content/uploads/2015/08/4744428334_13c70a6165_z-300x200.jpg 300w, https://www.rweber.net/wp-content/uploads/2015/08/4744428334_13c70a6165_z-150x100.jpg 150w, https://www.rweber.net/wp-content/uploads/2015/08/4744428334_13c70a6165_z.jpg 640w" sizes="(max-width: 300px) 100vw, 300px" /></div><p>Just a quick note this week. The JavaScript add-on Flickity is fun, but I don&#8217;t always get what I want from it immediately. Here&#8217;s the key I&#8217;ve deduced: everything Flickity is applied to needs to have accurate size beforehand. I&#8217;ve encountered two situations where that was not the case.</p>
<p>The first, explained in my <a href="https://www.rweber.net/web-development/css/gilding-the-gallery-mla-flickity/">MLA + Flickity post</a>, was when max-width: 100% set on images was causing anything not visible at the beginning of the slideshow to be blank &#8211; or, more accurately, zero width.</p>
<p>More recently, I was trying to create a slideshow in a page where most of the content accordion-folds up at mobile size. No applying Flickity with HTML there! If I did, I got one of two outcomes: if I set a height on my images, they all showed up stacked on top of each other. If not, the whole thing was the height of the combined top and bottom padding of the container. I needed to add a distinguishing class, and then set the accordioning code to check whether a panel it had just opened had that class. If so, apply Flickity from the JavaScript at that point. I&#8217;ve had no trouble with repeated opening and closing of the accordion.</p>
<p><strong>Edit 9/30:</strong> In fact yet a third issue has arisen: Flickity not knowing the height of the slideshow because it&#8217;s being applied before the page content is fully loaded. <code>$(document).ready</code> wasn&#8217;t enough; I needed <code>$(window).load(function () { /*call Flickity here*/ });</code><br />
[Edit 12/12/16: .load was deprecated many versions of jQuery ago and finally removed in v3. Try <code>$(window).on("load", function(){});</code>]</p>
<p><strong>Edit 2/23/16:</strong> I don&#8217;t know the reason for the conflict as of this writing, but I&#8217;ve since discovered that Flickity does not get along with CSS columns. With <code>overflow: hidden;</code> set on .flickity-viewport no images show, and with it removed, some images show outside of the viewport.</p>
<p>I hope this helps someone!</p>
<p><small>You Must Be This Tall to Ride from Eric Mesa via <a href="https://www.flickr.com/photos/ericsbinaryworld/4744428334">Flickr</a>.</small></p>
<p>The post <a href="https://www.rweber.net/javascript/troubleshooting-flickity-one-note/">Troubleshooting Flickity: one note</a> appeared first on <a href="https://www.rweber.net">rweber.net</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.rweber.net/javascript/troubleshooting-flickity-one-note/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">39155</post-id>	</item>
		<item>
		<title>Tweaking the simple auto-playing slideshow</title>
		<link>https://www.rweber.net/javascript/tweaking-simple-auto-playing-slideshow/</link>
					<comments>https://www.rweber.net/javascript/tweaking-simple-auto-playing-slideshow/#respond</comments>
		
		<dc:creator><![CDATA[Rebecca]]></dc:creator>
		<pubDate>Mon, 10 Aug 2015 12:00:55 +0000</pubDate>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[portfolio]]></category>
		<guid isPermaLink="false">http://www.rweber.net/?p=38469</guid>

					<description><![CDATA[<div><img width="300" height="206" src="https://www.rweber.net/wp-content/uploads/2015/07/Projecteur_de_diapositives_Prestinox_début_des_années_1960-300x206.jpg" class="attachment-medium size-medium wp-post-image" alt="image of slide projector" style="float:left; margin-right:16px; margin-bottom:16px;" decoding="async" srcset="https://www.rweber.net/wp-content/uploads/2015/07/Projecteur_de_diapositives_Prestinox_début_des_années_1960-300x206.jpg 300w, https://www.rweber.net/wp-content/uploads/2015/07/Projecteur_de_diapositives_Prestinox_début_des_années_1960.jpg 752w" sizes="(max-width: 300px) 100vw, 300px" /></div>
<p>Two variations on CSS-Tricks' Simple Auto-Playing Slideshow (jQuery): one to load slideshow content via AJAX, and one to turn each slideshow item into a question-answer pair.</p>
<p>The post <a href="https://www.rweber.net/javascript/tweaking-simple-auto-playing-slideshow/">Tweaking the simple auto-playing slideshow</a> appeared first on <a href="https://www.rweber.net">rweber.net</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div><img width="300" height="206" src="https://www.rweber.net/wp-content/uploads/2015/07/Projecteur_de_diapositives_Prestinox_début_des_années_1960-300x206.jpg" class="attachment-medium size-medium wp-post-image" alt="image of slide projector" style="float:left; margin-right:16px; margin-bottom:16px;" decoding="async" loading="lazy" srcset="https://www.rweber.net/wp-content/uploads/2015/07/Projecteur_de_diapositives_Prestinox_début_des_années_1960-300x206.jpg 300w, https://www.rweber.net/wp-content/uploads/2015/07/Projecteur_de_diapositives_Prestinox_début_des_années_1960.jpg 752w" sizes="auto, (max-width: 300px) 100vw, 300px" /></div><p>Ever since I found it probably close to a year ago, I&#8217;ve been a big fan of the <a href="https://css-tricks.com/snippets/jquery/simple-auto-playing-slideshow/">simple auto-playing slideshow on CSS-Tricks</a> (though perhaps surprisingly I have yet to apply it to a Media Library Assistant-generated WordPress gallery). I&#8217;ve tweaked it multiple times to serve different purposes, and thought I&#8217;d share two.</p>
<p>The first tweak is more of a wrapper than a modification. It has two features: it loads the slideshow content via AJAX, and it has a small change to the CSS to smooth the beginning of the slideshow.</p>
<p>I wanted to load the slideshow dynamically so I could turn it off entirely on mobile, without a Very Helpful Browser loading the images in case they were used later, slowing down the site. The page itself had the slideshow as a banner header, and it was collapsed at small sizes, so I used its height as the test in the JavaScript. There was a #slideshow div which had a background image set in CSS (via a class JavaScript removed) in case someone&#8217;s JavaScript was disabled, and the slideshow images were in a separate file as naked HTML (though the file was .php for no particular reason) to be pulled in with jQuery.load(). </p>
<p>As for the CSS, I found that trying to hide all but one image via CSS and have the JavaScript take over from there gave me a herky-jerky first transition. Instead, I hid everything in the CSS and used JavaScript to show the first image just as soon as the images were loaded up.</p>
<p>AJAXified slideshow JavaScript:</p>
<p><iframe src="http://pastebin.com/embed_iframe.php?i=RtXdEw1d" style="border:none;width:100%;height:175px;"></iframe></p>
<p>This and the JavaScript below need to be wrapped in a $(document).ready(function () { &#8230; }); to operate most smoothly.</p>
<p>CSS:</p>
<p><iframe src="http://pastebin.com/embed_iframe.php?i=PGNHEvtc" style="border:none;width:100%;height:250px;"></iframe></p>
<hr>
<p>The second tweak makes it a double slideshow: question and answer. In situ it uses WordPress text widgets, the title for the question and the content for its answer, but you can do it with any paired elements. The code below assumes a div with both class and id slideshow-wrapper, holding divs with class slideshow-item, each holding a pair of divs: .question and .answer. There are two different timeframes. The loop moves from pair to pair, and within it the question appears first, then the answer, they stay put for a while for reading, and then both fade away.</p>
<p>The other change to this one is that there&#8217;s a lone single animation outside the setInterval loop. Your choices without this separate bit are to have both the question and the answer in view immediately upon loading the page, or to wait with blank space for the entire first interval.</p>
<p>Q&#038;A slideshow JavaScript:</p>
<p><iframe src="http://pastebin.com/embed_iframe.php?i=UKTKj68q" style="border:none;width:100%;height:250px;"></iframe></p>
<p>CSS:</p>
<p><iframe src="http://pastebin.com/embed_iframe.php?i=HYYnqgmb" style="border:none;width:100%;height:250px;"></iframe></p>
<p><small><a href="https://commons.wikimedia.org/wiki/File:Projecteur_de_diapositives_Prestinox_d%C3%A9but_des_ann%C3%A9es_1960.jpg">Slide projector image by Jean-Jacques Milan via Wikimedia Commons</a></small></p>
<p>The post <a href="https://www.rweber.net/javascript/tweaking-simple-auto-playing-slideshow/">Tweaking the simple auto-playing slideshow</a> appeared first on <a href="https://www.rweber.net">rweber.net</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.rweber.net/javascript/tweaking-simple-auto-playing-slideshow/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">38469</post-id>	</item>
		<item>
		<title>Relative Position</title>
		<link>https://www.rweber.net/css/relative-position/</link>
					<comments>https://www.rweber.net/css/relative-position/#respond</comments>
		
		<dc:creator><![CDATA[Rebecca]]></dc:creator>
		<pubDate>Mon, 27 Jul 2015 12:00:47 +0000</pubDate>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[website layout]]></category>
		<guid isPermaLink="false">http://www.rweber.net/?p=21694</guid>

					<description><![CDATA[<div><img width="300" height="169" src="https://www.rweber.net/wp-content/uploads/2015/07/Pantograph01-300x169.jpg" class="attachment-medium size-medium wp-post-image" alt="image of pantograph copying device" style="float:left; margin-right:16px; margin-bottom:16px;" decoding="async" loading="lazy" srcset="https://www.rweber.net/wp-content/uploads/2015/07/Pantograph01-300x169.jpg 300w, https://www.rweber.net/wp-content/uploads/2015/07/Pantograph01-768x432.jpg 768w, https://www.rweber.net/wp-content/uploads/2015/07/Pantograph01.jpg 1024w, https://www.rweber.net/wp-content/uploads/2015/07/Pantograph01-150x84.jpg 150w" sizes="auto, (max-width: 300px) 100vw, 300px" /></div>
<p>Here, at great length, is the sequel to my post on aspect ratio, about vertical positioning. Again, horizontally, everything is easy &#8211; declare width: and left: as percentages, and as the screen size changes, they will change in tandem. For vertical positioning originally (i.e., almost a year ago &#8211; but then again, only almost a [&#8230;]</p>
<p>The post <a href="https://www.rweber.net/css/relative-position/">Relative Position</a> appeared first on <a href="https://www.rweber.net">rweber.net</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div><img width="300" height="169" src="https://www.rweber.net/wp-content/uploads/2015/07/Pantograph01-300x169.jpg" class="attachment-medium size-medium wp-post-image" alt="image of pantograph copying device" style="float:left; margin-right:16px; margin-bottom:16px;" decoding="async" loading="lazy" srcset="https://www.rweber.net/wp-content/uploads/2015/07/Pantograph01-300x169.jpg 300w, https://www.rweber.net/wp-content/uploads/2015/07/Pantograph01-768x432.jpg 768w, https://www.rweber.net/wp-content/uploads/2015/07/Pantograph01.jpg 1024w, https://www.rweber.net/wp-content/uploads/2015/07/Pantograph01-150x84.jpg 150w" sizes="auto, (max-width: 300px) 100vw, 300px" /></div><p>Here, at great length, is the sequel to <a href="https://www.rweber.net/web-development/css/aspect-ratio/">my post on aspect ratio</a>, about vertical positioning. Again, horizontally, everything is easy &#8211; declare width: and left: as percentages, and as the screen size changes, they will change in tandem.</p>
<p>For vertical positioning originally (i.e., almost a year ago &#8211; but then again, <em>only</em> almost a year ago) I thought it would be easiest to have a div above the one in question that always pushes it down by the correct amount, but you either have to do the aspect ratio business on it or slice your images so the aspect ratio is taken care of that way (hence my <a href="https://www.rweber.net/web-development/css/eliminating-white-space/">post on white space</a>). However, and I&#8217;m sure I read this when I was reading about padding but had it fly out of my brain for a while, not only is percent padding calculated from the width of the object, percent margin is too. Setting margin-top to the appropriate percentage will keep your objects in the correct vertical alignment upon resizing.</p>
<p>Just as with padding, though, in practice I didn&#8217;t get the predicted margin from my numbers.</p>
<p>If you know the percentage of the padded div&#8217;s width that your margin should be, and your padded div is not 100% of its container, you make the same calculation as for padding: (coded margin) = (desired margin)*(width). I have discovered that there is one situation where a div that is not 100% of its container is great: giving some element the same margin to the left and top edges of the screen. Suppose I want a margin that is 5% of the screen width, on an element that is 20% of the screen width. I can do <code>left: 5%;</code> and then calculate a margin-top. If the 20%-wide element is sitting immediately within a container that is the full width of the screen, the calculation simplifies nicely: 5% of the screen is 5% * 100% / 20% of the element (desired margin), but then you have to make the adjustment of multiplying by the width, 20%. You get (coded margin) = 5% * 100% / 20% * 20% = 5%, or (coded margin) = (desired margin).</p>
<p>One advantage to this method, aside from the lack of reassembled background slices, is that if you don&#8217;t have something from which to calculate a good margin or padding percentage it&#8217;s easy to tweak them and see how they look. I find myself occasionally mocking up pages without the final graphics in hand, so there&#8217;s a limit to how much arithmetic I want to do to fit everything together perfectly.</p>
<p>One final note: The reason this got put on the back burner originally is that I had unwittingly swapped out top and margin-top, so my test page was not working as expected. While left and margin-left are interchangeable for absolutely positioned elements, top and margin-top are not at all. Left, right, top, and bottom percentages refer to the height or width of the containing box according to whether they are height or width measurements; margin percentages are always according to the width of the containing box. Hence you will need margin for relative vertical positioning, though you may then need to set <code>top: 0;</code> to make sure your element is positioned relative to the top of the window.</p>
<p><small>3D pantograph rendering by Joseph Lertola, via <a href="https://en.wikipedia.org/wiki/Pantograph#/media/File:Pantograph01.jpg">Wikimedia Commons</a>.</small></p>
<p>The post <a href="https://www.rweber.net/css/relative-position/">Relative Position</a> appeared first on <a href="https://www.rweber.net">rweber.net</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.rweber.net/css/relative-position/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">21694</post-id>	</item>
		<item>
		<title>Gilding the Gallery 2: MLA + front-end filtration</title>
		<link>https://www.rweber.net/php-and-mysql/gilding-the-gallery-2-mla-front-end-filtration/</link>
					<comments>https://www.rweber.net/php-and-mysql/gilding-the-gallery-2-mla-front-end-filtration/#respond</comments>
		
		<dc:creator><![CDATA[Rebecca]]></dc:creator>
		<pubDate>Mon, 13 Apr 2015 12:00:26 +0000</pubDate>
				<category><![CDATA[PHP and MySQL]]></category>
		<category><![CDATA[Fancy Fifteen]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[portfolio]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress gallery]]></category>
		<guid isPermaLink="false">http://www.rweber.net/?p=37412</guid>

					<description><![CDATA[<div><img width="300" height="240" src="https://www.rweber.net/wp-content/uploads/2015/04/noJSgalleryscreenshot-300x240.png" class="attachment-medium size-medium wp-post-image" alt="Screenshot of gallery without JavaScript functionality" style="float:left; margin-right:16px; margin-bottom:16px;" decoding="async" loading="lazy" srcset="https://www.rweber.net/wp-content/uploads/2015/04/noJSgalleryscreenshot-300x240.png 300w, https://www.rweber.net/wp-content/uploads/2015/04/noJSgalleryscreenshot.png 752w" sizes="auto, (max-width: 300px) 100vw, 300px" /></div>
<p>The reason I wanted to use Media Library Assistant for the Flickity carousel was to coordinate with a set of albums that can be easily navigated by the site visitor, and easily managed by the site owner. This process is split into two posts. Here's today's outline:</p>
<ol>
<li>Use MLA to apply Att. Categories to images, where the categories are the albums.</li>
<li>Use WordPress's get_terms() function to generate a list of all categories, and within each, a list of all subcategories. Make each list a link that applies a query string to the URL when it is clicked.</li>
<li>Use the value in the query string to build the appropriate mla_gallery shortcode, and have a default for when the page is first loaded. Execute the shortcode with do_shortcode().</li>
</ol>
<p>The post <a href="https://www.rweber.net/php-and-mysql/gilding-the-gallery-2-mla-front-end-filtration/">Gilding the Gallery 2: MLA + front-end filtration</a> appeared first on <a href="https://www.rweber.net">rweber.net</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div><img width="300" height="240" src="https://www.rweber.net/wp-content/uploads/2015/04/noJSgalleryscreenshot-300x240.png" class="attachment-medium size-medium wp-post-image" alt="Screenshot of gallery without JavaScript functionality" style="float:left; margin-right:16px; margin-bottom:16px;" decoding="async" loading="lazy" srcset="https://www.rweber.net/wp-content/uploads/2015/04/noJSgalleryscreenshot-300x240.png 300w, https://www.rweber.net/wp-content/uploads/2015/04/noJSgalleryscreenshot.png 752w" sizes="auto, (max-width: 300px) 100vw, 300px" /></div><p>In <a href="https://www.rweber.net/web-development/css/gilding-the-gallery-mla-flickity/">the previous installment</a> of this series, we dynamically generated a gallery with the WordPress plugin Media Library Assistant and applied the JavaScript plugin Flickity to turn the gallery into a nice carousel. Today we&#8217;re going to tackle the real reason I wanted to use MLA for that carousel: to coordinate with a set of albums that can be easily navigated by the site visitor, and easily managed by the site owner. It&#8217;s remarkably difficult to find gallery plugins that mimic even the simplest of image-storing websites, with different albums that can be accessed from one page, especially if you want anything dynamically generated.</p>
<p><b>Edit:</b> Since I have made so many additions to Twenty Fifteen, I thought it would be useful to assemble them into a single child theme. You can see the <a href="https://github.com/ReveWeber/fancyfifteen">Fancy Fifteen code on GitHub</a>, or look at <a href="https://www.rweber.net/tag/fancyfifteen/">all posts here tagged fancyfifteen</a>.</p>
<p>As with the carousel, we&#8217;re going to put the albumization into Twenty Fifteen, and you can see its final form <a href="http://rweber.net/test_site/wordpress/gallery/">on my testing site</a> &#8212; at least for the time being. The non-JS version is pictured to left.</p>
<p>The final version of the gallery is achieved in six steps, which we&#8217;ll split in half. Here&#8217;s today&#8217;s outline:</p>
<ol style="clear:left">
<li>Use MLA to apply Att. Categories to images, where the categories are the albums. Subcategories are fine, though I&#8217;m not sure it&#8217;s good to go any deeper than one level down (and my code doesn&#8217;t support more than two levels in the hierarchy). We were thinking years for the main categories and individual events for the subcategories.</li>
<li>Use WordPress&#8217;s get_terms() function to generate a list of all categories, and within each, a list of all subcategories. Make each list a link that applies a query string to the URL when it is clicked.</li>
<li>Use the value in the query string to build the appropriate mla_gallery shortcode, and have a default for when the page is first loaded. We wanted the default to be the album for the current year, so even it is dynamic. Execute the shortcode with do_shortcode().</li>
</ol>
<p>It&#8217;s the long half.</p>
<h2>Step 1</h2>
<p>In the Media -> Att. Categories page, I created Attachment Categories called <strong>2015 Events</strong> and <strong>2014 Events</strong>, and one or two subcategories for each. I uploaded a bunch of images using Media -> Add New, and then went to Media -> Assistant to assign them categories. Though this would not affect the mechanics of creating the gallery, no image has a parent category directly assigned to it; they each belong to one subcategory, an event.</p>
<h2>Step 2</h2>
<p>For Steps 2 and 3 I created a special page template that will be applied to a page called Gallery (so you have to make a page named that! If you want to name it something else you can rename page-gallery to page-[slug of your desired page name] and leave the rest alone). I&#8217;m going to show them in their entirety rather than parsing them out into the two steps.</p>
<p>Contents of page-gallery.php:</p>
<p><iframe src="https://pastebin.com/embed_iframe.php?i=jU5R2FmF" style="height:305px;border:none;width:100%"></iframe></p>
<p>This is just a simplified version of page.php that calls content-gallery.php. I took out various extra bits that would potentially clutter the page.</p>
<p>Contents of content-gallery.php:</p>
<p><iframe src="https://pastebin.com/embed_iframe.php?i=8ERUwtU5" style="height:450px;border:none;width:100%"></iframe></p>
<p>I believe I built this off content-page.php, but in the few hours since I did it I&#8217;ve already forgotten.</p>
<p>Step 2 is covered in lines 15-46. Here&#8217;s what&#8217;s going on:<br />
Lines 20-24: Grab all Att. Categories without parents, in descending order (so most recent year will be first). If you have categories beginning with letters, you may wish to remove that attribute.<br />
Lines 25-27: Awkwardly chunk pieces of the (sub)category list item/link HTML into variables.<br />
Line 29: Start an unordered list.<br />
Lines 30-43: Loop through the collection of parent categories.<br />
 &#8211; 31-32: Grab the parent&#8217;s slug and create its list item. If you don&#8217;t plan to AJAXify this you can delete the definition of <code>$linkslug</code> above and remove it and one of the <code>$slug</code>s from each list item construction.<br />
 &#8211; 33-34: Open a nested unordered list and start it with the &#8220;All&#8221; item. You don&#8217;t have to include this, but I thought it was a bit of useful redundancy, in case someone wanted to see the whole year and didn&#8217;t realize the year itself was a link.<br />
 &#8211; 35-40: Essentially repeat 20-24 and 31-32 (within a loop like 30-43) for each parent category. The only significant change is telling get_terms a different parent: the current parent category instead of &#8220;none&#8221;.<br />
 &#8211; 41-42 and into 44: Close up all the lists.</p>
<p>You&#8217;ll notice the page content appears after this menu. If you don&#8217;t intend to AJAXify it, you may wish to put it above the menu, perhaps even outside of .filtration-gallery.</p>
<h2>Step 3</h2>
<p>This is covered in lines 52-66. You only need #current-album-wrapper if you plan to use AJAX.<br />
Lines 55-59: Is there a valid category slug in the URL, after <code>?album=</code>? If so, extract the pretty name of that category and display it as a header, and then build an MLA gallery shortcode to display the photos in that category. Of course you can change the other mla_gallery options or add some.<br />
Lines 60-62: Oh, there&#8217;s not a valid slug? Run a default MLA gallery shortcode. This is where you would make major changes to accommodate your particular album organization scheme.</p>
<h2>Bonus Step</h2>
<p>Just kidding, we&#8217;re not done yet.</p>
<p>I added this functionality to my Flickity child theme, but we&#8217;ll to make its own child theme here, plus style it. I already put headers on the preceding two files to match.</p>
<p>In a folder called albumized-twenty-fifteen, place the two files above, plus two more. I left their embed boxes short because this is already a really long post.</p>
<p>One called functions.php, which so far has no purpose other than enqueuing stylesheets:</p>
<p><iframe src="https://pastebin.com/embed_iframe.php?i=qhiV1Xfp" style="border:none;width:100%"></iframe></p>
<p>And one called style.css, which is kind of long despite the fact that I haven&#8217;t tweaked it as thoroughly as I would for a client:</p>
<p><iframe src="https://pastebin.com/embed_iframe.php?i=HMSgdpWU" style="border:none;width:100%"></iframe></p>
<p>Hey, we made it! Next time we&#8217;ll make this quicker and more compact, and appropriately the post should also be shorter.</p>
<p>The post <a href="https://www.rweber.net/php-and-mysql/gilding-the-gallery-2-mla-front-end-filtration/">Gilding the Gallery 2: MLA + front-end filtration</a> appeared first on <a href="https://www.rweber.net">rweber.net</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.rweber.net/php-and-mysql/gilding-the-gallery-2-mla-front-end-filtration/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">37412</post-id>	</item>
		<item>
		<title>Gilding the Gallery: MLA + Flickity</title>
		<link>https://www.rweber.net/javascript/gilding-the-gallery-mla-flickity/</link>
					<comments>https://www.rweber.net/javascript/gilding-the-gallery-mla-flickity/#respond</comments>
		
		<dc:creator><![CDATA[Rebecca]]></dc:creator>
		<pubDate>Mon, 23 Mar 2015 12:00:24 +0000</pubDate>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP and MySQL]]></category>
		<category><![CDATA[Fancy Fifteen]]></category>
		<category><![CDATA[Flickity]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[portfolio]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress gallery]]></category>
		<guid isPermaLink="false">http://www.rweber.net/?p=37349</guid>

					<description><![CDATA[<p>Applying the JavaScript carousel program Flickity to a WordPress gallery, or more properly a Media Library Assistant gallery, for responsiveness and easy updating.</p>
<p>The post <a href="https://www.rweber.net/javascript/gilding-the-gallery-mla-flickity/">Gilding the Gallery: MLA + Flickity</a> appeared first on <a href="https://www.rweber.net">rweber.net</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>I&#8217;ve done a lot of looking at gallery/slider/carousel plugins for WordPress, and haven&#8217;t been terribly enthusiastic about the selection. Very few interface directly with the WP Media Library, for instance, or allow easy categorization/photo album structure, and the responsiveness situation isn&#8217;t inspiring. Time to roll my own.</p>
<p><b>Edit:</b> Since I have made so many additions to Twenty Fifteen, I thought it would be useful to assemble them into a single child theme. You can see the <a href="https://github.com/ReveWeber/fancyfifteen">Fancy Fifteen code on GitHub</a>, or look at <a href="https://www.rweber.net/tag/fancyfifteen/">all posts here tagged fancyfifteen</a>.</p>
<p><a href="https://www.rweber.net/wp-content/uploads/2015/03/gallery-screenshot.png"><img loading="lazy" decoding="async" src="https://www.rweber.net/wp-content/uploads/2015/03/gallery-screenshot.png" alt="screenshot of carousel built with flickity.js and the WordPress plugin Media Library Assistant" width="792" height="468" class="aligncenter size-full wp-image-37466" srcset="https://www.rweber.net/wp-content/uploads/2015/03/gallery-screenshot.png 792w, https://www.rweber.net/wp-content/uploads/2015/03/gallery-screenshot-300x177.png 300w" sizes="auto, (max-width: 792px) 100vw, 792px" /></a></p>
<p>The goal here: a front page carousel that could be easily updated, with just half a dozen or so selections from the most recent images added to the site. The pictures would be human-chosen. The carousel needed to be responsive and easy to navigate (for everyone; i.e., accessible), and ideally the whole shebang could coordinate with a filterable photo gallery to be created for the same site.</p>
<p>Enter <a href="https://wordpress.org/plugins/media-library-assistant/">Media Library Assistant</a>. There are two functions of MLA that are important for this use: the addition of taxonomies to media library items directly, and the expansion of WordPress&#8217;s gallery shortcode into mla-gallery, with dynamic selection of media items by taxonomy, user-defined templates (as in direct control of the gallery&#8217;s HTML structure), and many other settings.</p>
<p>I figured I could apply a nice jQuery carousel to an MLA gallery of the correct form, and after looking around, <a href="http://flickity.metafizzy.co/">Flickity</a> seemed like the best candidate (with the implicit recommendation of <a href="https://css-tricks.com/creating-responsive-touch-friendly-carousels-with-flickity/">CSS-Tricks</a>). It is responsive, accessible, well-adapted to mouse/trackpad, keyboard, and touch, and styleable from the theme&#8217;s CSS file. After one significant (but easily remedied) hiccup we were in business!</p>
<p>Here&#8217;s how to set it up. There are some places where I made arbitrary decisions (such as downloading flickity.css but using a CDN for the .js file), but it should be easy to figure out how to make different ones.</p>
<p>For specificity, we&#8217;ll make a child theme to add this functionality to Twenty Fifteen. For now you can see this on my <a href="http://rweber.net/test_site/wordpress/carousel-page/">WordPress test site</a> but there is no guarantee that will continue to be true indefinitely.</p>
<p>style.css:<br />
<script src="https://pastebin.com/embed_js.php?i=DJhJRCEi"></script></p>
<p>Many themes set max-width: 100% on images for responsiveness purposes; it keeps them from exploding out of their housings when the browser gets smaller. However, you have to override it here or the images you can&#8217;t originally see may collapse to width 0. That was the hiccup I referred to &#8211; why is there blank white space when I click through the carousel?!? The last section highlights the gallery if you tab to it so you know you&#8217;ve tabbed to it; it&#8217;s straight off the Flickity website. I set a height of 200px; you can let it be determined by the images by removing that line of CSS and the line setGallerySize: false in carousel.js, below.</p>
<p>carousel.js:<br />
<script src="https://pastebin.com/embed_js.php?i=DzbT6BGc"></script></p>
<p>functions.php:<br />
<script src="https://pastebin.com/embed_js.php?i=PPeeD1LA"></script></p>
<p>Just put flickity.css, carousel.js, functions.php, and style.css (for your child theme) all into a folder called twenty-fifteen-flickity, zip it up, and upload it.</p>
<p>In Settings -> Media Library Assistant -> MLA Gallery (the middle tab), scroll to the bottom and create a template called carousel. Fill in the following boxes:<br />
Open: <code>&lt;div id='carousel-gallery' class='carousel-no-js'></code><br />
Item: <code>&lt;div class='carousel-item'><br />
	[+link+]<br />
&lt;/div></code><br />
Close: <code>&lt;/div></code></p>
<p>In Media -> Assistant, tag all images for the slideshow with &#8220;featured&#8221; (or something else, and then change &#8220;featured&#8221; in the shortcode below).<br />
Where you want the carousel, place the shortcode<br />
<code>[mla_gallery attachment_tag=featured mla_style="none" mla_markup="carousel" size=medium link=full]</code></p>
<p>Some notes:<br />
&#8211; Most everything is adjustable from the CSS file, the MLA shortcode options, or the Flickity options.<br />
&#8211; You&#8217;ll have to add appropriate styling for responsiveness, but no differently from usual.<br />
&#8211; For graceful degradation the images start with the class carousel-no-js and carousel.js replaces that with carousel-js-on; I haven&#8217;t styled .carousel-no-js at all and wouldn&#8217;t count this as finished without doing so, but how to style it is a matter of taste.<br />
&#8211; I threw a lightbox plugin onto the test site as well (Responsive Lightbox by dfactory) and it works without a squawk.</p>
<p>The post <a href="https://www.rweber.net/javascript/gilding-the-gallery-mla-flickity/">Gilding the Gallery: MLA + Flickity</a> appeared first on <a href="https://www.rweber.net">rweber.net</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.rweber.net/javascript/gilding-the-gallery-mla-flickity/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">37349</post-id>	</item>
		<item>
		<title>Aspect Ratio</title>
		<link>https://www.rweber.net/css/aspect-ratio/</link>
					<comments>https://www.rweber.net/css/aspect-ratio/#respond</comments>
		
		<dc:creator><![CDATA[Rebecca]]></dc:creator>
		<pubDate>Mon, 22 Sep 2014 12:00:53 +0000</pubDate>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[website layout]]></category>
		<guid isPermaLink="false">http://www.rweber.net/?p=15922</guid>

					<description><![CDATA[<p>Suppose you have a web page where a certain component needs to sit within a particular region of the background image, and you&#8217;d like the whole shebang to resize according to the browser window and maintain this alignment. That is, the position of the items relative to each other and their aspect ratios need to [&#8230;]</p>
<p>The post <a href="https://www.rweber.net/css/aspect-ratio/">Aspect Ratio</a> appeared first on <a href="https://www.rweber.net">rweber.net</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Suppose you have a web page where a certain component needs to sit within a particular region of the background image, and you&#8217;d like the whole shebang to resize according to the browser window and maintain this alignment. That is, the position of the items relative to each other and their aspect ratios need to hold constant even when their sizes and distance from the edges of the browser window are changing. This post is about aspect ratio; a later post will address relative positioning.</p>
<p>Horizontally there is no problem. Declare width: and left: as percentages, which will be relative to the screen size, and as it changes, they will change in tandem. Vertically there is a little more work to be done.</p>
<p>There is a well-established way to preserve aspect ratio via padding, which is calculated (when set as a percentage) relative to the width of the object rather than the width of the screen. The most complete tutorial I found on this was by <a href="http://cjwainwright.co.uk/webdev/aspectratio/">Chris Wainwright</a>, and I recommend it.</p>
<p>I had to make some changes, though. I didn&#8217;t have a wrapper div within which my padded div was 100% of the width; I set a percentage-of-screen width on my padded div directly. When I set padding according to my desired aspect ratio, the resulting div was enormously tall.</p>
<p>An example using numbers I have at hand: suppose the design has a segment that is 459 x 1358px, which has a 1:2.96 aspect ratio. Setting the padding to 296% produces an aspect ratio of 1:12.33. What is 12.33? Why, it&#8217;s 296/24, and 24% just happens to be the amount of screen width the segment was set to take up. </p>
<p>You can solve this with a tiny bit of algebra: if (actual padding) = (coded padding)/(width), then (coded padding) = (actual padding)*(width). In the latter equation you drop your desired aspect ratio into the &#8220;actual padding&#8221; slot. In this case, to get an aspect ratio of 1:2.96 on my 24% wide div, I have to set padding of 2.96*.24 = .7104 or 71.04%.</p>
<p>I reiterate that this is percent width <b>relative to the container</b>. For a single div you can avoid the arithmetic (and arguably make your code more readable, since the padding percentage will be the aspect ratio) by wrapping the padded div in a div of the desired width and letting the padded div have width 100%. This is, of course, how it&#8217;s done in the tutorials, but I haven&#8217;t seen one that explains why or warns against leaving the wrapper out.</p>
<p>However, if you have a vertically sliced background image to reconstitute I have found it&#8217;s actually better to set width on the padded divs directly, but with all padded divs inside a shared wrapper that they completely fill. The reason is that in this setting the padding on each individual div will be the aspect ratio of the entire unsliced image.</p>
<p>Here&#8217;s the algebra:<br />
<a href="https://www.rweber.net/wp-content/uploads/2014/07/aspectRatioAlgebra.png"><img loading="lazy" decoding="async" src="https://www.rweber.net/wp-content/uploads/2014/07/aspectRatioAlgebra-300x180.png" alt="diagram for the algebra of calculating aspect ratios of sliced background images" width="300" height="180" class="alignleft size-medium wp-image-21701" srcset="https://www.rweber.net/wp-content/uploads/2014/07/aspectRatioAlgebra-300x180.png 300w, https://www.rweber.net/wp-content/uploads/2014/07/aspectRatioAlgebra.png 750w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a> Assume the width of the whole image is 1, which makes the slice&#8217;s width X both raw and as a percentage. The slice and the entire image have height Y, so their aspect ratios are Y/X and Y/1. To get the coded padding we multiply the actual padding, Y/X by the percent width, which is X, resulting in Y (i.e., Y/1).</p>
<p>We can assume the unsliced width is 1 because to make it so is a unit of measurement conversion, which plays well with others. For example, if the actual width is 5000, and X and Y are raw measurements (X no longer serving as a percentage), the aspect ratio of the slice is still Y/X, the aspect ratio of the whole image is Y/5000, and the width of the image is X/5000. Multiplying actual padding (aspect ratio) by width then gives Y/X * X/5000 = Y/5000, the aspect ratio of the whole.</p>
<p>Anyway, algebra aside, this does save you some arithmetic, because the padding on the individual divs is all calculated with one division. The second part of this involves unraveling the quirks of percent margin, though this sentence should not be taken as a promise of its quick appearance.</p>
<p>The post <a href="https://www.rweber.net/css/aspect-ratio/">Aspect Ratio</a> appeared first on <a href="https://www.rweber.net">rweber.net</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.rweber.net/css/aspect-ratio/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">15922</post-id>	</item>
		<item>
		<title>Images, centering, and responsiveness</title>
		<link>https://www.rweber.net/css/images-centering-responsiveness/</link>
					<comments>https://www.rweber.net/css/images-centering-responsiveness/#respond</comments>
		
		<dc:creator><![CDATA[Rebecca]]></dc:creator>
		<pubDate>Fri, 13 Jun 2014 12:00:15 +0000</pubDate>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[images]]></category>
		<guid isPermaLink="false">http://www.rweber.net/?p=12861</guid>

					<description><![CDATA[<p>One of my first projects was to make a front page for a website, the sort of thing with an &#8220;Enter Site&#8221; link on it. It is mostly images, and I learned a lot about manipulating images in setting the page up and making it responsive. All of the following require setting a position attribute. [&#8230;]</p>
<p>The post <a href="https://www.rweber.net/css/images-centering-responsiveness/">Images, centering, and responsiveness</a> appeared first on <a href="https://www.rweber.net">rweber.net</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>One of my first projects was to make a front page for a website, the sort of thing with an &#8220;Enter Site&#8221; link on it. It is mostly images, and I learned a lot about manipulating images in setting the page up and making it responsive.</p>
<p>All of the following require setting a position attribute. Fixed, relative, absolute &#8211; anything but the default static.</p>
<p>At a small screen width I just use percentages for width.</p>
<pre>width: 60%;
left: 20%; // that is, half of 100-60</pre>
<p>will center an image or the div containing it. If you apply it to the image and the image is smaller than 60% of the current screen width it will expand to fit. If you apply it to a containing div and leave the image unstyled, then the image will appear in its natural size, extending outside the div if necessary. Styling the image with width: 100%; makes it fill the div exactly, regardless of its natural size.</p>
<p>For larger screens width by percentage isn&#8217;t as useful for images. I do not remember where I found this trick, but you can center a smaller image or div on a wide page with percentages and negative margins.</p>
<pre>top: 50%;
left: 50%;</pre>
<p>will center the top left corner of the image or div. Suppose the element is 250px wide and 400px tall. Add margins to shift the element so its center is centered.</p>
<pre>margin-top: -200px;
margin-left: -125px;
</pre>
<p>I used this technique to make sure the background image was centered regardless of browser window width, and, with appropriate margin adjustments, to stack a second div below the one in the center of the screen.</p>
<p>The post <a href="https://www.rweber.net/css/images-centering-responsiveness/">Images, centering, and responsiveness</a> appeared first on <a href="https://www.rweber.net">rweber.net</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.rweber.net/css/images-centering-responsiveness/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">12861</post-id>	</item>
	</channel>
</rss>
