notes about wordpress version of salisburyandstonehenge.net

SalisburyThis page is a bit of documentation for how I do stuff on the multifarious websites that I’ve perpetrated over the years. These are very much notes for myself but if anybody else should happen upon this page I hope you find it useful 🙂

On This Day – how it works

These are a couple of vim things I use regularly.

My local history website has a list of stuff that happened on this day’ in Salisbury’s history

I maintain the list by adding a page for each event into a WordPress page structure that looks like this:

  • on-this-day
    — month
    — event page, title of which is prefixed by the date

I fill in the event pages’ ‘Order’ field (under ‘Page Attributes’) with the day of the month. The months’ ‘Order’ field has the ‘number of the month’ (i.e. 1 is January, 2 is February etc). This keeps everything in order.

Then the top level page has this:

    

I think I’m going to change this to have a separate wp_list_pages for each month. This will allow me to have a table of contents, although it will slow it down, I guess.

On This Day – reformatting from dynamic list of WordPress child pages to static list for the weekly post

Anyhoo, I use the top level list to create a weekly post, summarizing that weeks events in Salisbury history.

There are a couple of vim things that help me do that.

When I grab the page source from the top level list, each page looks like this:

  • 28th April 1948 - Terry Pratchett's birthday
  • which looks like this on the page:

    I could just cut and paste that, but I think it looks a little bit nicer, in the context of a post to do the following, in gvim.

    This removes the ‘class=”page_item page-item-7354″‘ bit. I’m not sure what it’s for but I’m pretty sure it’s not useful in this context

    :%s/ class="page_item page-item-[0-9][0-9]*"//

    Then I’m moving the date out of the anchor text to the start of the line. I could probably do this in one hit, but for the time being I’m mapping a key and then executing it manually once for each line

    :map b />[0-9]ld4w0lllp

    Then typing ‘b’ renders the html like this:

  • 6th April 1967 - Pink Floyd play Salisbury City Hall
  • …which looks like this:

    I prefer this for the posts.

    On This Day – reformatting for the Parish Mag

    A slight variation on the above – this is for re-formatting the On This Day stuff for the Parish mag

    map q /[0-9][0-9][0-9][0-9] dw$A (pi).
    

    then

    / May
    cw: 
    

    WH Smith Deep Linking

    Get the Deep Link

    Go to the Deep Link page:

    https://www.affiliatewindow.com/affiliates/customise_link.php?mid=3017

    Paste in the URL from the product page:

    This generates a Deep Link:

    WHSmith

    For a simple text link that’s all you need.

    <

    h4>For the picture credit, book end the text link with:

    Pic: The book cover is an ‘affliate link’, which means that if you click on it it will take you to the

    and

    If you buy anything on Smith’s website I get a commission. The image is copyrighted, but because it’s essentially a way of advertizing the product, so I think that this is ‘fair use’

    To turn this into a picture link

    Insert the image as normal. This gives you some html like this:

    Bill Bryson - Notes from a Small Island
    

    Replace the anchor text section (i.e. ‘WHSmith‘) with the image spec from what was inserted from the WordPress gallery

    Bill Bryson - Notes from a Small Island

    Tags: mattaff, mtpaff

    Advertisements