<?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>Fancy Fifteen Archives - rweber.net</title>
	<atom:link href="https://www.rweber.net/tag/fancyfifteen/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.rweber.net/tag/fancyfifteen/</link>
	<description>trying to be a mile wide AND a mile deep</description>
	<lastBuildDate>Sun, 09 Dec 2018 13:51:35 +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>Conquering scrollbars</title>
		<link>https://www.rweber.net/css/conquering-scrollbars/</link>
					<comments>https://www.rweber.net/css/conquering-scrollbars/#comments</comments>
		
		<dc:creator><![CDATA[Rebecca]]></dc:creator>
		<pubDate>Mon, 06 Jul 2015 12:00:34 +0000</pubDate>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Fancy Fifteen]]></category>
		<category><![CDATA[portfolio]]></category>
		<category><![CDATA[website layout]]></category>
		<category><![CDATA[WordPress]]></category>
		<guid isPermaLink="false">http://www.rweber.net/?p=38333</guid>

					<description><![CDATA[<div><img width="300" height="150" src="https://www.rweber.net/wp-content/uploads/2015/07/ribbon-32696_1280-300x150.png" class="attachment-medium size-medium wp-post-image" alt="image of tangled scroll" style="float:left; margin-right:16px; margin-bottom:16px;" decoding="async" srcset="https://www.rweber.net/wp-content/uploads/2015/07/ribbon-32696_1280-300x150.png 300w, https://www.rweber.net/wp-content/uploads/2015/07/ribbon-32696_1280-768x384.png 768w, https://www.rweber.net/wp-content/uploads/2015/07/ribbon-32696_1280-1024x512.png 1024w, https://www.rweber.net/wp-content/uploads/2015/07/ribbon-32696_1280-150x75.png 150w, https://www.rweber.net/wp-content/uploads/2015/07/ribbon-32696_1280.png 1280w" sizes="(max-width: 300px) 100vw, 300px" /></div>
<p>So suppose you want to fix the sidebar on a Twenty Fifteen WordPress site, because most of the time it's going to be short enough to fit entirely on the screen. And suppose you don't want the nice wide scrollbar Internet Explorer (even 11) will put down the edge of your sidebar whether or not scrolling is happening or even possible. Let's talk about that.</p>
<p>The post <a href="https://www.rweber.net/css/conquering-scrollbars/">Conquering scrollbars</a> appeared first on <a href="https://www.rweber.net">rweber.net</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div><img width="300" height="150" src="https://www.rweber.net/wp-content/uploads/2015/07/ribbon-32696_1280-300x150.png" class="attachment-medium size-medium wp-post-image" alt="image of tangled scroll" style="float:left; margin-right:16px; margin-bottom:16px;" decoding="async" srcset="https://www.rweber.net/wp-content/uploads/2015/07/ribbon-32696_1280-300x150.png 300w, https://www.rweber.net/wp-content/uploads/2015/07/ribbon-32696_1280-768x384.png 768w, https://www.rweber.net/wp-content/uploads/2015/07/ribbon-32696_1280-1024x512.png 1024w, https://www.rweber.net/wp-content/uploads/2015/07/ribbon-32696_1280-150x75.png 150w, https://www.rweber.net/wp-content/uploads/2015/07/ribbon-32696_1280.png 1280w" sizes="(max-width: 300px) 100vw, 300px" /></div><p>So suppose you want to fix the sidebar on a Twenty Fifteen WordPress site, because most of the time it&#8217;s going to be short enough to fit entirely on the screen. Maybe it&#8217;s not always going to be, or maybe it&#8217;s just a little too long so you want to have it scrollable but not tied to the scrolling of the rest of the page. You can do that. Actually, it&#8217;s pretty easy if you aren&#8217;t concerned with aesthetics: <code>position:fixed; height:100%; overflow:scroll;</code> on the sidebar should cover you. However, Internet Explorer (even 11) will put a nice wide scrollbar down the edge of your sidebar whether or not scrolling is happening or even possible. Here we&#8217;ll talk about making that not happen.</p>
<p>The key is a lightweight jQuery plugin called <a href="http://rocha.la/jQuery-slimScroll/">jQuery-slimScroll</a>. It adds a lovely and styleable scrollbar only as necessary, and allows you to avoid overflow:scroll entirely (which is the source of the IE scrollbar).</p>
<p>In your wp-content/themes/fancyfifteen folder you&#8217;ll need 4 files: functions.php, style.css, aqa-pretty-scrolling.js, and header.php (the scrolling requires adding a wrapper to the sidebar content, which in Twenty Fifteen is in the header file).</p>
<p>As will now be standard, you can get the code for all of my Twenty Fifteen modifications in one big (but separable) <a href="https://github.com/ReveWeber/fancyfifteen">Twenty Fifteen child theme on GitHub</a>.</p>
<p>header.php:<br />
<iframe src="https://pastebin.com/embed_iframe.php?i=H5b9vFFV" style="border:none;width:100%"></iframe></p>
<p>The only thing in header.php that is different is the div with id &#8220;pretty-scroll&#8221;, just inside the div with id &#8220;sidebar&#8221;. Everything else is exactly as in Twenty Fifteen, which is why I haven&#8217;t bothered making this very large.</p>
<p>functions.php:<br />
<iframe src="https://pastebin.com/embed_iframe.php?i=hvTWxVHB" style="border:none;width:100%"></iframe></p>
<p>This is also very standard: enqueue your parent and child stylesheets, then enqueue jQuery-slimScroll and our JavaScript program that makes use of it. These enqueuings could be combined.</p>
<p>style.css:<br />
<iframe src="https://pastebin.com/embed_iframe.php?i=p81eN61a" style="border:none;width:100%;height:400px;"></iframe></p>
<p>This is simple but getting more interesting. The sidebar isn&#8217;t along the side until the screen gets sufficiently large, hence the media query. If a visitor has JavaScript turned off, they will get a fixed sidebar with overflow: scroll, trading an ugly scrollbar for a usable sidebar. Otherwise, the code will tack on the hide-scroll class, erasing the scrollbar. The rest of the styles bring the widgets closer together; if you are not accordion-folding them you may not want them closer, but then again if you&#8217;re not accordioning them what are the odds you have few enough to want to fix your sidebar?</p>
<p>aqa-pretty-scrolling.js:<br />
<iframe src="https://pastebin.com/embed_iframe.php?i=bFQnD8wR" style="border:none;width:100%;height:275px;"></iframe></p>
<p>Finally, we have the little bit of code that sets everything up and activates jQuery-slimScroll. If the sidebar is fixed (this seemed an easier indicator to use than sizes), the sidebar and pretty-scroll div get overflow:hidden on them, and then slimScroll scrolls pretty-scroll within sidebar. If you have trouble with bits of your sidebar not scrolling with the rest, uncomment the line that sets position: relative on pretty-scroll. For a quick and easy style match, set the scrollbar color to one of your site&#8217;s main colors. It will be translucent, so a darker one will likely look better.</p>
<p>There you have it. It took a little while for me to get this set up so there was no scrollbar visible on IE, but now that I have a template I&#8217;ll be using this whenever I have a piece of a page that scrolls independently of the rest of the page.</p>
<p><small>Complicated scroll from <a href="https://pixabay.com/en/ribbon-fancy-banner-scroll-border-32696/">Pixabay</a></small></p>
<p>The post <a href="https://www.rweber.net/css/conquering-scrollbars/">Conquering scrollbars</a> appeared first on <a href="https://www.rweber.net">rweber.net</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.rweber.net/css/conquering-scrollbars/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">38333</post-id>	</item>
		<item>
		<title>Accordion Widgets for Twenty Fifteen</title>
		<link>https://www.rweber.net/css/accordion-widgets-for-twenty-fifteen/</link>
					<comments>https://www.rweber.net/css/accordion-widgets-for-twenty-fifteen/#respond</comments>
		
		<dc:creator><![CDATA[Rebecca]]></dc:creator>
		<pubDate>Mon, 29 Jun 2015 12:00:27 +0000</pubDate>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Fancy Fifteen]]></category>
		<category><![CDATA[portfolio]]></category>
		<category><![CDATA[WordPress]]></category>
		<guid isPermaLink="false">http://www.rweber.net/?p=38318</guid>

					<description><![CDATA[<div><img width="275" height="300" src="https://www.rweber.net/wp-content/uploads/2015/06/sparrow-158178_1280-275x300.png" class="attachment-medium size-medium wp-post-image" alt="illustration of sparrow playing accordion" style="float:left; margin-right:16px; margin-bottom:16px;" decoding="async" fetchpriority="high" srcset="https://www.rweber.net/wp-content/uploads/2015/06/sparrow-158178_1280-275x300.png 275w, https://www.rweber.net/wp-content/uploads/2015/06/sparrow-158178_1280-768x839.png 768w, https://www.rweber.net/wp-content/uploads/2015/06/sparrow-158178_1280.png 938w, https://www.rweber.net/wp-content/uploads/2015/06/sparrow-158178_1280-137x150.png 137w" sizes="(max-width: 275px) 100vw, 275px" /></div>
<p>Let's accordion the sidebar widgets in Twenty Fifteen to make a fairly short sidebar even shorter - perhaps short enough to fit entirely within the screen and be fixed in place.</p>
<p>The post <a href="https://www.rweber.net/css/accordion-widgets-for-twenty-fifteen/">Accordion Widgets for Twenty Fifteen</a> appeared first on <a href="https://www.rweber.net">rweber.net</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div><img width="275" height="300" src="https://www.rweber.net/wp-content/uploads/2015/06/sparrow-158178_1280-275x300.png" class="attachment-medium size-medium wp-post-image" alt="illustration of sparrow playing accordion" style="float:left; margin-right:16px; margin-bottom:16px;" decoding="async" loading="lazy" srcset="https://www.rweber.net/wp-content/uploads/2015/06/sparrow-158178_1280-275x300.png 275w, https://www.rweber.net/wp-content/uploads/2015/06/sparrow-158178_1280-768x839.png 768w, https://www.rweber.net/wp-content/uploads/2015/06/sparrow-158178_1280.png 938w, https://www.rweber.net/wp-content/uploads/2015/06/sparrow-158178_1280-137x150.png 137w" sizes="auto, (max-width: 275px) 100vw, 275px" /></div><p>More additions to Twenty Fifteen! Why not gather these all together into a single child theme? Well, why not? You can <a href="https://github.com/ReveWeber/fancyfifteen">see it all on GitHub</a>, though I haven&#8217;t yet caught up with myself.</p>
<p>I haven&#8217;t said what we&#8217;re doing yet. So you have a website with Twenty Fifteen, and you don&#8217;t have too much in your sidebar &#8211; the menu, which isn&#8217;t too long, and maybe a few widgets. What if you made the sidebar collapse down nice and short so you could fix it in place? It is wonderfully simple to do.</p>
<p>You&#8217;ll need a folder in your wp-content/themes/ directory called &#8220;fancyfifteen&#8221; to use these files as-is. It will have three files in it: functions.php, aqa-sidebar-accordion.js, and style.css.</p>
<p>functions.php:<br />
<iframe src="https://pastebin.com/embed_iframe.php?i=kneN241L" style="border:none;width:100%;height:350px;"></iframe></p>
<p>There are three chunks of code in functions.php: the first brings in the stylesheets for both Twenty Fifteen and Fancy Fifteen, the second adds HTML to widget titles that we will later use for drop-down/collapse-up arrows, and the third brings in the JavaScript that actually does the accordioning. You can leave out the middle section if you don&#8217;t want the arrows.</p>
<p>aqa-sidebar-accordion.js:<br />
<iframe src="https://pastebin.com/embed_iframe.php?i=eZtm4GWr" style="border:none;width:100%;height:350px;"></iframe></p>
<p>Progressive enhancement! If the site visitor has JavaScript turned off, all widgets will be open. Otherwise they will all close up. The commented-out line would then reopen the first one, provided it has a title; that seemed to be the most efficient way to have the first widget auto-open. The way I wrote this JavaScript, any widget without a title won&#8217;t collapse (ever). You could use that fact to have, say, a search bar that is always visible.</p>
<p><a href="https://github.com/ReveWeber/fancyfifteen/blob/master/style.css">For style.css, visit GitHub.</a> There&#8217;s nothing tremendously interesting there &#8211; it just mimics the built-in support for drop-down submenus. If you decided to leave out the middle chunk of functions.php and forgo arrows, you only need the top comment block of style.css &#8212; but you definitely need that! It&#8217;s got the information WordPress needs to understand the theme and its relationship to Twenty Fifteen.</p>
<p>Next time we&#8217;ll discuss actually fixing the sidebar in place. The trick is to allow scrolling if the contents are longer than the page, but avoid the economy-sized scrollbar Internet Explorer slaps on anything styled overflow:scroll.</p>
<p><small>Accordion-playing bird from <a href="https://pixabay.com/en/sparrow-bird-brown-feather-hat-158178/">Pixabay</a>.</small></p>
<p>The post <a href="https://www.rweber.net/css/accordion-widgets-for-twenty-fifteen/">Accordion Widgets for Twenty Fifteen</a> appeared first on <a href="https://www.rweber.net">rweber.net</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.rweber.net/css/accordion-widgets-for-twenty-fifteen/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">38318</post-id>	</item>
		<item>
		<title>Gilding the Gallery 3: Ajaxifying the filterable gallery</title>
		<link>https://www.rweber.net/javascript/gilding-the-gallery-3-ajaxifying-the-filterable-gallery/</link>
					<comments>https://www.rweber.net/javascript/gilding-the-gallery-3-ajaxifying-the-filterable-gallery/#respond</comments>
		
		<dc:creator><![CDATA[Rebecca]]></dc:creator>
		<pubDate>Mon, 20 Apr 2015 12:00:21 +0000</pubDate>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP and MySQL]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[Fancy Fifteen]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[portfolio]]></category>
		<category><![CDATA[WordPress gallery]]></category>
		<guid isPermaLink="false">http://www.rweber.net/?p=38038</guid>

					<description><![CDATA[<div><img width="300" height="243" src="https://www.rweber.net/wp-content/uploads/2015/04/galleryscreenshot2-300x243.png" class="attachment-medium size-medium wp-post-image" alt="" style="float:left; margin-right:16px; margin-bottom:16px;" decoding="async" loading="lazy" srcset="https://www.rweber.net/wp-content/uploads/2015/04/galleryscreenshot2-300x243.png 300w, https://www.rweber.net/wp-content/uploads/2015/04/galleryscreenshot2.png 749w" sizes="auto, (max-width: 300px) 100vw, 300px" /></div>
<p>Last time we set up the PHP (slash HTML, slash CSS) to dynamically generate Media Library Assistant gallery shortcodes and an album menu. Everything works without any JavaScript. Today we're going to add JavaScript, with jQuery, to do three things.</p>
<ol>
<li>Hide the album menu under a button, a la a mobile menu.</li>
<li>Use AJAX to reload only the portion of the page containing the gallery.</li>
<li>Push each new URL into the browser history, so that the back button works and individual albums can be bookmarked.</li>
</ol>
<p>The post <a href="https://www.rweber.net/javascript/gilding-the-gallery-3-ajaxifying-the-filterable-gallery/">Gilding the Gallery 3: Ajaxifying the filterable gallery</a> appeared first on <a href="https://www.rweber.net">rweber.net</a>.</p>
]]></description>
										<content:encoded><![CDATA[<div><img width="300" height="243" src="https://www.rweber.net/wp-content/uploads/2015/04/galleryscreenshot2-300x243.png" class="attachment-medium size-medium wp-post-image" alt="" style="float:left; margin-right:16px; margin-bottom:16px;" decoding="async" loading="lazy" srcset="https://www.rweber.net/wp-content/uploads/2015/04/galleryscreenshot2-300x243.png 300w, https://www.rweber.net/wp-content/uploads/2015/04/galleryscreenshot2.png 749w" sizes="auto, (max-width: 300px) 100vw, 300px" /></div><p><a href="https://www.rweber.net/web-development/php/gilding-the-gallery-2-mla-front-end-filtration">Last time</a> we set up the PHP (slash HTML, slash CSS) to dynamically generate Media Library Assistant gallery shortcodes and an album menu. Everything works without any JavaScript. Today we&#8217;re going to add JavaScript, with jQuery, to do three things.</p>
<ol>
<li>Hide the album menu under a button, a la a mobile menu. This will prevent the problem of a menu that&#8217;s so large the gallery is four pages down.</li>
<li>Use AJAX to reload only the portion of the page containing the gallery. This will make for a smoother experience.</li>
<li>Push each new URL into the browser history, so that the back button works and individual albums can be bookmarked. It&#8217;s always a source of an annoyed &#8220;really?&#8221; when I try to go back to a page I bookmarked and find that the address leads to only the most general version of the page, not where I actually was.</li>
</ol>
<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><center><a href="https://www.rweber.net/wp-content/uploads/2015/04/galleryscreenshot.png"><img loading="lazy" decoding="async" src="https://www.rweber.net/wp-content/uploads/2015/04/galleryscreenshot-300x243.png" alt="screenshot of finished gallery" width="300" height="243" class="alignnone size-medium wp-image-38269" srcset="https://www.rweber.net/wp-content/uploads/2015/04/galleryscreenshot-300x243.png 300w, https://www.rweber.net/wp-content/uploads/2015/04/galleryscreenshot.png 749w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a> <a href="https://www.rweber.net/wp-content/uploads/2015/04/galleryscreenshot2.png"><img loading="lazy" decoding="async" src="https://www.rweber.net/wp-content/uploads/2015/04/galleryscreenshot2-300x243.png" alt="screenshot of finished gallery" width="300" height="243" class="alignnone size-medium wp-image-38271" srcset="https://www.rweber.net/wp-content/uploads/2015/04/galleryscreenshot2-300x243.png 300w, https://www.rweber.net/wp-content/uploads/2015/04/galleryscreenshot2.png 749w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a></center></p>
<p>Here&#8217;s a pair of screenshots. You can&#8217;t tell in this because I didn&#8217;t make a ton of categories, but the menu will also drop over the photos. Again, at least for the time being, you can see and interact with this <a href="http://rweber.net/test_site/wordpress/gallery/">on my testing site</a>.</p>
<p>All three steps are actually handled in one short jQuery-reliant JavaScript file.</p>
<p>Call it gallery-menu.js, put the following into it, and save it in your child theme folder:</p>
<p><script src="https://pastebin.com/embed_js.php?i=Ed76FGUa"></script></p>
<p>Line 2 is sort of pre-Step-1. It&#8217;s for graceful degradation &#8211; it adds a class so we can style the menu and gallery separately depending on whether JavaScript is enabled or not.<br />
Lines 3-6 control Step 1. They hide the menu to begin with and activate the button to show and hide it.</p>
<p>The rest is Steps 2 and 3. If you click a link within the menu, JS swoops in and stops the browser from following it (line 9). Then we construct the relevant piece of the desired URL from the link, using the data-slug attribute we added into the PHP last time, and furthermore tack on the specific div that holds the images (lines 10-11). Line 12 does the AJAX, Line 13 re-hides the menu as it would be were the page reloaded, and Line 14 pushes the new URL into the browser history.</p>
<p>And this is why hearts fly out of my eyes sometimes when I work with jQuery.</p>
<p><b>Edit 3 May:</b> To get my lightbox plugin to apply to this gallery I had use JS to add a rel attribute to each link. The AJAX &#8211; or maybe simply do_shortcode &#8211; seemed to prevent the automatic application of the lightbox to the image links (which wasn&#8217;t the case with the <a href="https://www.rweber.net/web-development/css/gilding-the-gallery-mla-flickity/">Flickity slideshow</a>). What you need will depend on what plugin you use, of course, but for WP Lightbox 2 I had to add <code>$( '#current-album a' ).attr( 'rel', 'lightbox[album]' );</code> at line 7 and as a post-AJAX function to the .load call (see my <a href="https://www.rweber.net/web-development/javascript/things-ive-relearned-recently/">notes on .load syntax</a>).</p>
<h2>Are we there yet?</h2>
<p>Of course not. We have bonus steps to this part of the program as well.</p>
<p>Tack this onto the end of your functions.php file:</p>
<p><script src="https://pastebin.com/embed_js.php?i=wiDHVLXc"></script></p>
<p>Insert this CSS just before the media queries in style.css:</p>
<p><iframe src="https://pastebin.com/embed_iframe.php?i=3zCz2PzY" style="height:305px;border:none;width:100%"></iframe></p>
<p>And finally, insert this CSS inside the max-width: 43.75em media query (not the portrait one):</p>
<p><script src="https://pastebin.com/embed_js.php?i=50PtnmKC"></script></p>
<p>The styling could be way better, so play with it till you lose your mind.</p>
<p>The post <a href="https://www.rweber.net/javascript/gilding-the-gallery-3-ajaxifying-the-filterable-gallery/">Gilding the Gallery 3: Ajaxifying the filterable gallery</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-3-ajaxifying-the-filterable-gallery/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">38038</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>
	</channel>
</rss>
