Category Archives: Site Development

Adventures In Coding: Some Idea Of Direction

I mentioned a little bit ago about looking at map plugins for WordPress, as a significant element in a website I’ve been doing some groundwork for, and want to launch several months ago. Realistically, that last part is getting less likely every day, but you never know. If you happen to develop time travel, get in touch.

Anyway, I was trying out the plugin Geo Mashup. I think that actually trying something out (on a local machine) has given me a better sense of what features I actually want, and more of a sense where plugins fall short. Fortunately, Geo Mashup has some flexibilities, in the documentation it gives you sample code to put in your theme to add a feature that has some similarity to a feature that I want to add.

The features I’m very much liking at the moment, are that you can put a map on a post, and limit the number of items that appear there. Then you can have a page with a map that includes the map markers from all the posts you’ve ever done.

What would be a big step forward, would be the ability to assign particular markers to particular places. The documentation mentions the possibility of doing that based on the Category of the location, but what I’m doing, occasionally thing would fit into multiple categories, which suggests things getting messy. The code the documentation points you to, can change the marker based on the date you set for the location, and can be adapted to work with the categories.

So naturally, I want to do better, and I think it ought to be relatively straightforward to create a plugin that lets you assign a map marker to a particular location.

I say “relatively”, compared to making a full plugin that does everything from scratch. It would involve creating two database tables, a page in the admin end to set what you want the marker options to be, and to assign one of those chosen markers to the places you’ve put into the database, and finally to force the chosen markers to be displayed.

I say “ought”, because I haven’t actually made a plugin before. So I’ve been poking around in the Geo Mashup code, to see how it does things.

The most helpful file I found initially, was the “uninstall” file. I’d poked around in the database, and seen the tables that Geo Mashup had already created. In uninstall, I saw how it removed them. More of a challenge was finding where it had added them in the first place. This involved figuring out how to convince Windows to search for file contents, a feature I was happily using in XP, but from Vista on has been very helpfully hidden. Not removed, just made hard to find.

With the help of a brief web search, I found out how to search for file contents, and how to include .php files in that sort of search, and then I believe I found where the tables were created.

Now it gets more complicated, because while there’s an obvious “uninstall”, there’s not an obvious “install”: got quite a bit of figuring out where things are called and how, to follow that procedure to get my own plugin to set itself up.

Then the next challenge is to follow how plugins create their own options pages in the admin area of WordPress, and get that page set up. The contents should be uncomplicated, because I have a concept of what I want displayed and how, but I haven’t even looked at how plugins make their own pages yet.

The last thing will be to force the right markers to display on the map. So if I want red pins for some things, green pins for other things, and purple pins for still other things, and I’ve set them to do that in my plugin, how to stop the default Geo Mashup marker from displaying, and putting these up instead. I’ve a notion of how this works, but it’s a ways off. And at least there’s the sample code, that should give some hints, right?

Code is kind of like a big Cat’s Cradle. One big tangle of string. For it to work, it needs to remain a big tangle of string, but for you to do anything with it, you need to be able to follow it. Not necessarily from beginning to end as such, but what bit’s going where and why, and follow the string through a knot where lots of sections have been tied up together. It’s not always easy to just set down and pick up again.

To switch analogies, have you ever fiddled with the cords in the back of your computer? You need to plug something into the power strip, but all the slots are full, You know you’re not using the printer, so can unplug that for the time being. You follow the cord from the printer to the power strip, and unplug it, only to find you’ve unplugged the monitor or the router instead. Code’s like that, only much more so. One missed comma or semicolon, and things just don’t work right.

I think it’s doable, lots of people have made plugins, much more complicated than I hope to. Just a big string to untangle. Though in the last few years I’ve been learning weaving, there’s quite a few threads I’ve had to untangle, so I’ve had some practice.

A Short Experiment In Map Plugins

Today we had a craft day at our house. I saw some rubber-stamping going on, some jewellery-making stuff was out (or, perhaps more accurately, the jewellery had mostly been made beforehand, there may have been stuff that needed fixed). My tiny little niece had her handprints taken.

I tried to keep Youngest occupied downstairs some of the time, with the old Captain Scarlet. the cars, planes and other vehicles zhooming, that helped. Sadly it only worked for about 2 batches of 20 minutes, getting us about 10 minutes into episode 2.

A bit later on, I spent some minutes on some figuring out for a new website project that has been in the background for a while.

I took the XAMPP stack on the laptop, and deleted most of the pages from the WordPress install on there (it was the template for the Transfiguration site, and isn’t needed for that anymore). And of course changed some of the placeholder text to new placeholder text.

The main thing I need to figure out, for a large chunk of the functionality of the site, is which map plugin to use. There’s going to be lots of posts about different places, do each post will need to have a view of that place, but then it would be nice to see all the site markers (or possibly just categories of them) on the map.

There are, of course, many options out there: some free, some paid, some maintained, some long-obsolete. Various pages that reviewed the options had similar issues: some of the recommendations were out-of-date, and so on.

I’d looked these things up before, of course, but I figured it was time to bite the mullet and try something.

Mentioned on only one of the comparison review posts I read, I thought I’d give Geo Mashup a go. Free is always nice, especially when you’re still figuring out just what it is you want.

I did one post with one location. While I told the plugin to where I wanted the map to point, first time I apparently didn’t tell it to actually put the map in the post. This was quickly rectified. The default zoom amount was too far out, but I didn’t go back in and fiddle with it any more at that point.

I need to give the thing a good long workout, with lots of map points. I forget if this was one where you could change what the markers look like for different things, which would be helpful, so when I’m ready to spend more brain on it, I shall burrow into all that.

Still, progress is nice :)


Another Project Lives!

In a few posts, I’ve mentioned a site for a friend that I’ve been working on. So far, I haven’t really wanted to link to it, because a rather rough version of it has been up for quite a while now.

But now, I’ve pulled the trigger on activating the New Pretty Version of the site. There’s a few things that I still need to work on on it (including, but not limited to, blowing my own trumpet that I did some work on the thing), but right now I’m pretty pleased that it’s looking mostly as it ought.

So, check out my friend Josh’s site: Native American Silversmith.

Structure and Progress

A week or two ago, my wife and I started a new structure that gives us more time for Getting Things Done, and for Spending Time (with each other and kids).

After feeling a bit like a train that’s blowing steam and spinning wheels, this new structure is helping me feel like I’m getting some momentum.

Me up at 8, get stuff done before the kids get up, get everyone up at 10, spend time, oversee schoolwork and stuff, let the evening happen, and aim to get to bed…. about an hour ago. Not quite perfect at it yet.

Aiming to blog here every day, and I’ve only missed one day since starting the site. the Transfiguration site is more of a Sunday project, Sundays are getting a little busy in the lead up to Deacon Dan’s ordination in a couple of weeks.

After not feeling like I was making any progress, I’ve come ahead in leaps and bounds for the documentation for my friend’s site (looking forward to the Big Reveal).

The site I’m looking forward to prioritising when my friend’s site is done, is currently more extremely on the back burner than is the Transfiguration site, but I’m managing to line up a bunch of stuff to help with content, once I’m ready to switch over (bookmarks, equipment, other plans – it’s like lining up the long stick piece in a verrry slllloooow game of Tetris).

Even managed to get some stuff done today that I knew I had to do, but had forgotten on more than one occasion (renewing the library card).

Feels like the wheels are turning. just need to remember that thing, “All work and no play makes you a jerk.”

Square Notes Into Round Clefs

Today I was working on stuff for the Holy Transfiguration site.

I went back into MuseScore and converted the Beatitudes from four staves (as I did it initially) to two (soprano and alto together on the treble clef, and tenor and bass together on the bass clef).

Copying and pasting first the alto and the bass, changing them to Voice 2, and then copying and pasting the soprano and the tenor, worked for the most part. Things like triplets, quadruplets and quintuplets (which is how I work around the notes that are chanted quicker than a quaver) didn’t survive being changed between the voices, sometimes slurs needed redoing, and fermatas didn’t survive the voice-switching either, so it was a bit more work than I hoped, but it went ok.

I tried following that up by transcribing “Vouchsafe, O Lord”. I’m not really happy with its’ current state: some parts seem a little slow, and I’m not sure if it’s that the whole thing is slow. The tuplets I put in seem ok, I’m a bit paranoid that they will be too fast if I end up needing to up the tempo for the piece as a whole. I’m not happy with this piece, yet. Not ready for the limelight.

I did, fairly quickly upon searching, find an image that would be good to use on our service books. When I’m closer to having all the pieces ready for one of the service books, I’m pretty sure I’ve found the right email address to ask for permission to use it. I found them on a blog, which linked back to another site, who credited someone for giving them permission, I’ve found the email address of someone with his name, so with any luck…

Not entirely happy with the free hosting place I’m using there. Throws up an ad when you go there, and it disagrees a lot with Internet Explorer. A friend has offered me a very charitable rate for hosting the Transfiguration site with him. Very much tempted to go with that. Need to discuss it before I jump into that.

A Different Kind Of Coding

In addition to the site for a friend that I mentioned the other day (nearly there, nearly there), I have also created a website for my church.

As part of the site, I’m uploading music that we use, hopefully to help new visitors, or people elsewhere looking into Orthodox Christianity.

To be honest, I started transcribing the music before I thought of doing the site: I’m not so good at harmony, and I was hoping to get the hang of the bass part before we were due to perform a song (that one’s not up yet, I’ll explain in a bit). It almost worked: singing and thinking the bass tune while hearing the soprano is somewhat tricky.

I’m using MuseScore for my transcription. I came across it a few years ago, when Windows Media Player was sucking at playing Final Fantasy MIDIs. Now I’m getting used to writing in it.

Time signatures in Orthodox church music are somewhat complex. Or to put it another way, they don’t really use bars. In a lot of cases, one tune (a “Tone”) is used for various different texts, so a line of music has to be adapted to different lengths to accommodate varying lengths of text.

What I’ve been doing, then, is when starting a new score, I’ve set a basic time signature (usually Common time), the tempo, and the number of bars I want. Then I delete the “C” denoting Common time (which at an early stage like this changes nothing), and change each bar to the length it needs to be (often between 8/4 and 15/4, few have been less, but a few have been more than that).

Took me a while to figure that out, also took me a while to figure out where to add in tempo, and how to have notes of differing length at the same place in the same stave (using Voices).

The earliest things I transcribed, I need to go back and redo, armed with all these things I’ve picked up along the way.

Today, despite missing the kids-having-rest-time and kids-watching-a-Sunday-show window of opportunity, I managed to do O Gladsome Light, one of my favourite hymns from Vespers. I like the “now that we have come to the setting of the sun” and “for meet it is at all times” parts. Orthodox Wiki has a nice page detailing the history of the song.

I’d started in earnest with transcribing Vespers (fewer changeable hymns), and started at the beginning. At this point I’ve skipped the changeable hymn, because I’m not sure how I’m going to integrate it into the new service book. Another day…

Today, I also started putting files up onto the Files page of the church site. The transcription and that website are my Sunday project, it’s nice to make progress on projects.

Integrating WooCommerce Into Your Theme

I have been working on a WordPress-based website for a friend.

This endeavour has been something of a crash course into the intricacies of theme modification, PHP and style sheets. I had already started learning PHP and MySQL together, but I hadn’t got as far as style sheets. I do have a background in fiddling with programming, so I did have a bit of a comfort level – knew I could always change things back, could follow code reasonably well, could guess at what to change based on the helpful names people give things.

Skipping lots of details about messing with the Twenty Twelve and Twenty Fifteen themes, deciding on Noteskine theme, modifying that and begging the author to find out how to remove some of the functionality, I found out that WooCommerce wasn’t co-operating with my theme.

This had me stumped for weeks. I’d forced Noteskine’s footer bar to be active on all pages (something I may end up not doing on the full site – note to self: need to make decisions about that), and the background of that was not displaying, and the background for the shop content was also invisible. I’m running the Simple Full Screen Background Image plugin, so the placeholder product image was straight on a fairly detailed background, and the text was hard to see as well.

WooCommerce documentation says that their .css files are one long line, a human-readable version has the same filename but .scss is the extension.

Working from that basis, I dequeued woocommerce.css and woocommerce-layout.scss. I also copied wrapper-start.php from a WooCommerce subfolder into a theme subfolder: [theme]/woocommerce/global – that overrides the original.

I fiddled with the above, and just wasn’t seeing the results I was expecting. After lots of trying things, I thought I would start from (more or less) scratch.

Woo has built-in compatibility for WordPress’s default Twenty-named themes. I mentioned earlier that I’d messed with Twenty Twelve and Twenty Fifteen – I hadn’t achieved much by trying child themes “by the book”, I took each theme, copied it into a renamed folder, and changed the name of the theme in all the files (otherwise there would be a certain amount of clash with the original – found that out the hard way. Something couldn’t be declared twice…). This turned out to be an advantage – I could activate a butchered Twenty Fifteen. Woo wouldn’t recognise it, so then I could intentionally direct Woo to use its own code, but in my theme, not the plugin.

Telling wrapper-start.php to use Woo’s own styling for Twenty Fifteen worked. (Worked in the modified Noteskine as well, but didn’t solve the footer menu problem).

Dequeuing the style sheets from the plugin and enqueuing the .scsses (renamed to .css) in the theme, again didn’t achieve what it should have done. It’s supposed to be the same code, right? It should do the same thing?

After getting absolutely nowhere on various forums (you can probably find my posts if you search not-particularly-hard – though one forum they had me reword twice before just closing the thread), and contacting the theme author (not something I’d particularly wanted to do having already troubled him to modify his theme, and it turned out WooCommerce was outside his experience and wasn’t really the theme’s intent), I tried something I should have tried long before.

I took the original woocommerce.css and woocommerce-layout.css, and added line breaks and indentation.

They were very different to the .scss versions. Copying and modifying those (or not, to start out with), magically started yielding the kind of results I’d expected before.

Because you start wondering, “Am I enqueuing these the right way?” (I’d tried several ways). Or a more general “What am I doing wrong?”

The answer is only that the .css and the .scss aren’t (or possibly weren’t, who knows if they’ve fixed it) the same code.

If you run into the same trouble, I hope you find this blog, because I went searching high and low: I found other people with similar problems (none seemed terribly recent), but I didn’t find anyone with a solution.