Dating WordPress

This post is going to attempt to document how I figured out how to mess with dates in WordPress custom fields. I don’t know how widely valuable that is but a number of the concepts are probably broadly applicable. This particular discussion will wander into areas of programistan and there is one child theme page involved.1 It’s live and working (although it may occasionally be down when I do something odd and it’s ugly as sin at the moment) but feel free to look around or add some fake events. Getting all posts with a custom field named ‘event’ to show on the front page was discussed here. I added a bit to the theme so that if there was more than one event on that day it’d display it with a different format. You can see the whole page on GitHub here. The other little chunk of code that might matter is what’s returned if there are no events on that day. It just tells you nothing is there and presents you with the events for the next seven days as defined by the FacetWP layout (which I’ll go over in a bit). Now that we had a decent way to see what was going on that day, I built the “Event Creator” form which will allow the instructor […]

Show Today’s Events

In WordPress it’s easy to delay publishing until a certain date or to show posts published on a certain date but I didn’t know of an easy way to show posts associated with a certain date. What I wanted to do was allow an instructor to write a bunch of posts about art related events in the local area. They’ll be browsable in a variety of ways but we wanted the ones that were relevant to today to show up on the home page automatically so they’d get attention etc. This was one of those scenarios where I say something like “I am confident it can be done but I’ve never done it or seen it done.” In my head it made sense. I tried a few different ways but I’ll start with the one that worked and was pretty easy. It does require that you make a child theme but I plan to make a plugin that’ll do it if you give me a few days. Anyway, here’s the chunk that does the work. It is, as usual, a result of looking through the WordPress Codex. This is the source for the current time and the light finally went on that I didn’t even need to search a particular custom field as I read this piece on wp_query for […]

13

bbPress and Multisite Sanity Saver/Savior

By default bbPress will enroll you as a form participant on every site you go to when you’re logged in on a multisite installation. It is meant to be helpful but usually results in a headache. People get nervous that people they don’t know are in their users list. Other people want to un-enroll to clean up their sites list. I found this solution a while back but since the way I did required modifying a core file it was overwritten on a recent update. It took me a while to figure out what what was done where so I’m putting it in this post as a reminder and with slightly more specific directions for other similarly clueless people. You’ll be editing the following file bbpress/inlcudes/users/capabilities.php that ought to live in your plugins directory (wp-content/plugins/bbpress) All you need to do is look for the /** Ready comment and then replace the code below with (I duplicated some code that isn’t actually replaced to help show more context)

Bootleg Daily Create

Given a different type of planning I’d have started with Alan’s Daily Create Theme but that’s now how these particular stars aligned. Instead I had a course site that was mostly built and had been polished in a variety of theme specific ways when the daily create idea came up. I didn’t really want to mess with switching themes etc. as time is getting short. Plus there was probably more than a bit of curiosity if I could stitch 80% of the functionality together via non-programmistan means. I turned to a few of my old standbys to get this done. The theme remains Flat Bootstrap. The plugins pulling the majority of the weight are- Feed WordPress– pulls in the student blogs, Flickr images, and possibly Twitter via this Gravity Forms– lets the site admins create daily create prompts in a structured way without needing to know exactly what they’re doing Display posts shortcode– lets us easily embed the participant submissions with the prompt Simply Exclude– will allow us to include/exclude categories from specific pages. In this case I just wanted to keep the Flickr generated daily create elements from cluttering up the main bloggregate page. I’m ok with showing blog submissions here even if they are daily creates. On the looks side, I’m using Jetpack to do the custom CSS […]

Let the Birds Sing (Feed WordPress Filter)

Sometimes it’s the tiny, little bitty things. This is one of those times.1 Issue: Lesley Bullock is an awesome ornithology instructor who has all her students doing field work and they’re aggregating their work to a main mother blog hub. She is even having them record and upload bird songs which is entirely awesome. The problem was that when aggregated, the built in WordPress player wouldn’t show up. Oddly, it’s there in the code. I could see it there taunting me (below). However, the visibility was set to hidden. Once I realized the content was coming in, I tried the least invasive response- that is I just tried to override the CSS using the custom CSS option in Jetpack. No dice. Given that this is hardcoded into the post at the element level that wasn’t a huge surprise but it was worth a shot.2 I considered a few other options- Feed WordPress advanced filters, altering the core WordPress files . . . and they either wouldn’t do what I wanted or they felt too dramatic given the limited use case. I eventually got to the wonderful site for Feed WordPress (far superior to the WP plugin support page). There’s all sorts of good information on creating plugins/filters for Feed WordPress. What I ended up making is incredibly trivial but it […]

Semi-Programistan and Other Conundrums

I can create basic child themes. I can make some low level plugins. I can take themes and plugins as they’re given and live with the shortfalls. Lately I’ve become (more?) interested with the space between those two options. Can I use one or two plugins to create the equivalent of on-the-fly-child-themes? Can I teach other people who aren’t interested in making child themes how to do it? How replicable are the design/building patterns? To parallel that line walking, I’ve repeatedly tried to deal with the example/tool/tutorial structure in a way that might get people curious. Building lists of tools doesn’t appear to have advantages long term. I’ve done that too many times. Plus it puts the focus on the wrong element from the start. At the same time people need to see the association between tool and possibility.1 For this to ever really work well there has to be a fairly tight entwining of tool, possibility, and example. This site is supposed to show examples by discipline, tell how to make them (tutorial/FAQ), and add in other interesting and useful elements. It may be this matters more to us internally. It’ll help provide a quick way to find examples in the moment of need when talking to instructors and provides enough documentation for most of our internal people to […]

Add a Custom Masonry Layout with 2 Plugins

I’ve been meaning to set up a Masonry style layout for my weekly photography posts for a while. After my earlier post meshing together plugins, I figured now was the right time to show how to do it. Sure you could do this with a child theme and some specific themes have this layout. There are also some Masonry plugins that’ll get you some of this. This path allows you a good bit more freedom in the end and hopefully walks the middle path between intimidating coding and still having some real control over the end product/style etc. It’s also not a bad example pattern for integrating other javascript options without the hassle/upkeep of child themes etc. Plugins Needed Display Posts Shortcode – gets us the posts we want Specific CSS/JS for Posts/Pages – lets us tie in the masonry JavaScript library and custom CSS To Business Activate those plugins. Make a page where you want your Masonry layout to show up. You’ll have the option at the bottom of that page (or post) to link to the mansonry library and turn it on for the page. You can see that below. You can put the CSS in this area as well. Don’t forget to wrap it in the style tags. Since I was using a Bootstrap based theme I […]

Bootstrapping Nonprogramistan

I want to be like Alan Levine someday but as I slowly progressively acquire the necessary coding skills I often make do with various kinds of semi-programistan hackery. Today was an example of that and so worth a bit of blogging. Jesse Goldstein, one of a cadre of most favored sociologists, sent me an email asking how hard it’d be to do a few things with his course site for Understanding Capitalism. He wanted the front page to have – three columns- each from a separate category a way to highlight items of import in the leftmost column a static chunk of text in the leftmost column There are lots of ways to do this. I’m actually confident I could write a child theme to do this . . . but it was fun to do it without that and to do it in about 30 minutes as we sat at the .1 The Theme Jesse course started out with the tried and true Twenty Fourteen theme. It’s a nice theme but not really the one I’d choose for something with three columns. I’ve really been enjoying Flat Bootstrap lately. It’s nice and clean both in the code and in the presentation and it’s, as the name implies, built on the Bootstrap framework which makes all sorts of neat tricks […]

Gravity Forms: Exploring a Design Pattern

creative commons licensed ( BY-NC-ND ) flickr photo shared by clement127 One of the things we use a lot is what I’ll call templated submissions using Gravity Forms. It’s a solid performer across a variety of activities, disciplines, and instructor technology comfort levels. Costs/Benefits The content is guided/scaffolded so you get consistently constructed products (core elements are there and presented in a consistent manner) in a way that never quite works out with free form entries.1 Want to make sure students apply four lenses of analysis to a website review and end up with consistent titles and formatting? This is the type of construction where forms really help. Often this pattern is used as a way to get the advantage of creating web content without having to give students their own usernames/blogs/etc.2 It does reduce that overhead and makes good sense in situations where a full blog or authoring rights to a common blog may be overkill. One of the main advantages of this type of pattern is ending up with a visible, interactive, and useful aggregation of content. Make that matter. When these assignments have a larger purpose and audience things get far more interesting. A Few Examples These are live classes so please don’t submit entries at these sites. PSY 323< - focused on student submission of video/presentations […]

WordPress Multisite- Quick Delete to Reuse Email

Image thanks to Armando. In WordPress Multisite, a user can sign up under an email address. They then decide to delete their account for some odd reason. If they try to sign up again under that same email, it’ll say the email address is being used and will become available in a few days. In a situation like ours (all accounts are restricted to VCU email addresses) that’s a problem. You can jump right into phpMyAdmin and delete the row that contains this information in the wp_signups table. That’s no big deal unless you have a giant database and then using phpMyAdmin1 is a very special kind of slow motion misery. The following two piece solution allows me to just go to a website, enter the email address I wish to expunge and presto change-o the email is available to be used again. This isn’t rocket science (but it may be helpful) and there may be alternate paths. Those who know better, feel free to warn and/or educate me. Piece 1 A little tiny HTML form. Piece 2 1 It’s likely someone with more skills would just use the command line to knock all this out but I’m not there yet. I’m working on it.