19

Clean Google Doc Cut/Paste into WordPress Editor

If you cut/paste from a Google Doc into the WordPress WYSIWYG editor you get more than I want. Mainly a bunch of inline CSS that sets the font weight (see below). This is a pain because it’s going to take priority in CSS land and undoing it by hand is a hassle. Some internet wandering led me to Jonathan Nicol’s fix for some span elements and bit of adjustment allowed me to also deal with the inline CSS elements. The extra nice aspect of this as a fix is that it only applies on paste actions so you can still write the stuff in the HTML editor if you want.

02

User Choice: Hiding Some Sites in My Sites in WordPress Multisite

Long have I struggled with WordPress Multisite and the way it makes things difficult for non-super admin users. While it is very easy to join additional sites, leaving them on your own is easier said than done. I hesitate to write ‘impossible’ even now as it seems insane that there isn’t a good and obvious way for non-site admins to leave a site. Maybe someone will point out something obvious I’ve missed but in case I am right here is a way to allow users to control which sites show up in their My Sites list. After some thought, I went with the least dramatic path here. We are just removing the sites from the main views rather than deleting accounts on individual blogs. I started to go that route (remove_user_from_blog) but a conversation with Matt and the concerns about transferring ownership of the content or deleting the content and being able to un-do that if a mistake was made quickly made me think of some other options. I opted to use add a filter to the get_blogs_of_user function which builds both the drop down menu of sites and the blogs listed on the My Sites page. With the function below I can pass in an array of blog IDs to ignore when building the ‘My Sites’ list. You’ll also […]

WordPress Comment Setting Advice

We shifted some of our default comment settings in rampages. This is an attempt to give students better insight into what setting options they have and why they might make certain choices. DISCUSSIONS IN WORDPRESS Commenting is one feature of WordPress that you can control so that it behaves in ways that match your personal goals. You have lots of choices between shutting commenting off entirely and opening comments completely. You can find your discussion preferences at Dashboard>Settings>Discussion. A screenshot of what you’ll see there is included below. Default article settings The first portion, default article settings, are of these options all checked by default. Article tends to just mean blog post but might also apply to other things. The first option, attempt to notify any blogs linked to from the article, is about your post notifying another site that you linked to them in your blog post. That’s handy if you’re looking to make connections between your site and others but may be something you want to uncheck if you’re discussing sensitive topics or simply don’t wish to seek out conversation with individuals outside VCU. The second option, allow link notifications from other blogs, allows other blogs to alert you that your post or page was referenced in their post. Once again, this could help build community and it […]

28

Mother Blog – Troubleshooting Guides

I realize I have many, many things. It’s not clear if those things will be of use to other humans but, at worst, here is something you can ignore. At best, take some hard-won experience and avoid the hassle. These five things solve 98% of our mother blog syndication issues for students. On the professor side . . .

23

Change New Site Comments Settings in Multisite

This little function in a network activated plugin on WordPress multisite will require comment users to be a member of the multisite to comment. The setting can be changed by the blog admin but it makes the default setting a bit more restrictive. It’s changing the value in Dashboard>Settings>Discussion.

01

Super Cleansing Cut/Paste into Tiny MCE in WordPress

Had someone cut/pasting from Google Docs into WordPress and it was ending up littered with internal style elements and super irritating span classes. I found this post which got me 95% of the way there and just added .removeAttr(‘style’) to get rid of the inline styles. Now I can just re-cut/paste and get a clean chunk of text.

24

Accessible ACF-Based Tooltip Dictionary

We have a bunch of world language professors prying at the edges of Pressbooks. One of the requests yesterday was to be able to create a mini-dictionary of target language words at the beginning of sections written in that target language. Mousing over the words would show their English equivalent. The intent is to have ready assistance for those who need it so that writing in the target language can happen earlier in the course. ACF came to mind pretty quickly for this case. I really just needed the ability to generate two values that are paired together- the target language word and the English definition. I need to be able to make as many of these pairs as the person wants to put in there. That’s custom made for the ACF repeater field. Now that I had an easy way for people to add the words, I just needed a way to do the tooltip display. There are 12,000 ways to do this but I just looked around for one that bragged on its accessibility. I found this example on codepen and went with it. This bit of php builds that content. Now that we have the the content and way to handle the tooltip piece, I needed to stick it at the top of the posts. That’s just […]

Will Wonka asking you to tell him again what WordPress can't do.

Workshop to Event Workflow in WordPress

I have been doing little other than semi-real web development for three weeks across a number of projects. It’s a level of sustained practice/work that I’ve probably never done before. Who knew that kind of focus could actually result in fairly dramatic improvement? One of the projects is the reconstruction of our ALT Lab department page and I have had the chance to really do some stuff that I’ve been considering for several years. There’s a lot going on in the site but I’ll focus on one little concept/workflow for the moment. We have two goals in this case. We want a browsable catalog of workshops we offer that can be shared with people so they can request them.1 We need a calendar of events. Those events will include workshops that are presented at a particular date. We use Events Calendar Pro for this and are very happy with it. Workshops – The Post Type Step one was to create a custom post type called ‘workshop’ and then assign some custom fields to it with ACF. That keeps the content fairly consistent in look/feel and gives us enough standardization to do other tricks. We ended up with a custom post interface that looks like the gif2 below. You can see the ability to add learning objectives, examples, audience etc. in […]

17

iFrame Height

We have a site on rampages.us that’s being used for the creation of world language OER modules. They’re using H5P and a variety of media elements with some text to give context etc. The goal was to be able to embed these pages on another WordPress site that is running PressBooks on another server. There are two levels of hassle I wished to make go away. I didn’t want them having to go into text view and I didn’t want them to have to guess how big the page was to set the iframe height manually. I started going down the road with a WordPress plugin for iframe resizer but was failing to do something right and got annoyed . . . so I went in multiple other directions. Given I had control of both sites, I decided I’d make my own little embed code cut/paste element on the source site that’d use a simple shortcode plugin on the destination site.1 The source site got a little element on the PHP end that would show you the embed code box if you were an editor or higher. A dab of javascript gets us the height and writes out the iframe details. A bit more javascript gives us a button that will copy it to the clipboard. Now the people can […]