Comment on paragraphs – WordPress Plugin

Last week I posted about a little wordpress plugin I wrote called FancyCatlist. It made a nice little category menu similar to the kind of thing you would see on Everyblock. I wrote it as part of the process of putting together one of the sites I want my students to use next year as part of their practice in online publishing. You can see it in action on the ‘work in progress’ site.

The site is a ‘beatblog’ kind of thing and in searching around for examples of different approaches to this kind of thing I stumbled back upon ‘community news engine’ Newsmixer.

Newsmixer.com

Newsmixer.com

Its a nice idea and especially impressive as it was a jschool project which you can find out more about on the site itself. But the bit that caught my eye was the ability to comment on each paragraph of the content (and more as you’ll see if you go and explore)

I liked that idea as it taps in to the ‘One Par. One fact’ discipline of  basic journo writing and turns it in to a kind of microlink activitiy. It also begins to stem ideas off from various parts of an article, not just an article itself. Of course the reverse is that it could abstract all meaning out of the text. But used well, as I think it is here, I think it stands up.

So I think to myself that this would be a nice feature to have on the students publication website. But not, in the first instance,  as a way of the reader leaving feedback but as a way for me to leave feedback. A way that I could comment on each paragraph to give students feedback on what they write. I should point out that as I write this, it’s the policy of the department to keep student publications behind a firewall (I’m not so happy with that but hey ho). So feedback in the open is not a problem.

Finding a micro-comment plugin

I had a look around to see what was out there that would do a similar thing. This included poking around the newsmixer source (which is opensource) to see if it was worth using their framework. But they are using python. Great but my head (and life) is too crammed to learn that. Ryan Mark, one of the developers of newsmixer, has announced that newsmixer is heading the way of an API and there will be a wordpress plugin to tap in to all the neat features. But that seems a way off.

The next thing I did was search for wordpress plugins.  The closest I found was marginalia which looks very nice but doesn’t seem to play well with WordPress 2.8 and even with some nice features didnt look like it would scale back to what I wanted.

So I wrote another plugin.

The Feedback By Paragraph plugin

Feedback by Paragraph is a plugin that does a number of things

  • It hijacks the content of the post, looking for the </p> tag and inserts some code that attaches a pop-up box to that paragraph so you can leave comments. It inserts a little bubble with a link to open the box which also displays the number of comments there already. It only does this on the article page (what WP calls a single post as defined by the template single.php). It uses the closing p tag because it’s the easiest one to find as the <p> is often full of crap like classes etc and my regex is not really up to that. Using </p> also has the advantage of picking up any image captions without breaking the styling class.
  • It saves any paragraph comments with a custom ‘comment type’ so that they can be associated with a paragraph
  • It filters out any paragraph comments from the normal comment display.
  • It only allows you to comment if you are an admin or the post author but anyone can see the comments.
Feedback By Paragraph

Feedback By Paragraph

You can see it in action  the beatblog site

An issue.

This is now resolved.

There is a big issue to be aware of with this plugin.  When you submit a comment form with a custom comment_type defined  it isnt processed like all the other form elements. I’m not sure why that is but it takes an ammendement to the one of the core files in wordpress to make it (at least that’s the only way I got it to work). That means a tweak to a file called wp-comments-post.php.

Around line 40 you need to add the line

$comment_type = ( isset($_POST['comment_type']) ) ? trim($_POST['comment_type']) : null;

And around line 62 you need to change

$comment_type = '';

to

//$comment_type = '';

I know, not ideal. I’m sure there is a better way to do this which involves hooks and filters and all that. Please if anyone has even half an idea how this might be done I’d love to hear. But I have yet to find it(or understand it).

How do I use it?

You can download the plugin to try.

What next

There is plenty of flexibility in this plugin and an options page wouldn’t go a miss. I’ll be looking at setting it up so that you have more control over who sees what and perhaps look at setting a template for the comments form so that it isnt hidden in the plugin code. But for now, given that my sites are behind a fire wall it seems to work for me.

Let me know if you download and try the thing. Oh, and don’t forget that tweak of the core file.

NOTE: First bug fix! This version makes the call to the database for the comments using the generic form rather than being hard coded to a particular table. Sorry!

Visit the feedbackBP plugin page

Enhanced by Zemanta

Bookmarks for July 27th through August 6th

These are my links for July 27th through August 6th:

  • How blogs became part of BBC News « Reportr.net – "The story of how blogging is changing journalism at the BBC is told in my research paper, The Blogging BBC: Journalism blogs at “the world’s most trusted news organisation”, published in the August edition of Journalism Practice." and the blog post has lots more interesting stuff around the subject of blogging inside a media organisation
  • Local online news video advertising: 6 ways to monetize content | Online Journalism Blog – The last in a three-part series on local online news video in the US. This time it's all about the money
  • Social Media and the New Distributors « Reinventing the Newsroom – "Even when publishers embrace social media, I worry that they may see it primarily as a way for readers to talk among themselves. " and other interesting musings on the way social media is becoming distribution from Jason Fry
  • Internet Isn’t Killing Papers, We Are | Tech Business – Here's a challenging view : "Newspapers have had to refund advertisers ad dollars in the millions to compensate for having cheated their customers with inflated circulation numbers. In addition to the direct cost, there’s been an indirect cost in terms of trust and loyalty. Advertisers like having an independent means of verifying the impact of their ads."
  • "Graceful Hacks" – UX, IA and interaction design tips for hack days – currybetdotnet – 4 August, 2009 – The mighty Martin Belam has "some tips about how to avoid your hack looking like this unfortunate baby rhino". Stylesheets, layout and more for lovely looking pages and apps
  • Rupert Murdoch plans charge for all news websites by next summer | Media | The Guardian – "Quality journalism is not cheap," said Murdoch. "The digital revolution has opened many new and inexpensive distribution channels but it has not made content free. We intend to charge for all our news websites."
  • Communications not dented by downturn | Ofcom – "The recession is failing to dent our love of communications, with UK consumers spending more time than ever before watching TV, using their mobile phone and surfing the internet." There are some interesting stats on how different ages connect to the web with an apparent dip in the over 50's.
  • Local online news video design and usability: What’s working, what’s not – Part 2 of Vadim's US based study of local video. This part looks at usability and the way video is presented
  • A lesson from Patchwork Nation: Frameworks for Reporting – Chris Amico reflects on how the Patchwork nation (a formidiable 'demographic' reporting project) has informed his approach to data driven journalism. I can't really pick a quote here to reflect the tone. What struck me was that the whole piece carries the tone that this has really worked for Chris. The technology and process have slipped in to place.
  • Social videography – the future of short-term multimedia? – "I would argue that videography is the answer for sustainable short-term multimedia. Furthermore, video journalists need to utilize YouTube, Vimeo and other social media sites to secure this growing community of video enthusiasts." This in the light of what seems to be a concerted push towards short-form, user generated, quick news hits with a short shelf life.
  • FT Bosses Launch PR Offensive For Paid-Content Model | paidContent – "Editor Lionel Barber (pictured) tells Channel 4 in an interview (embedded after the jump) that there is now “an inexorable momentum behind charging for content” " Because we can't work out any better way whilst the industry is running around looking at ways to retain bonkers profit margins. (ok, I added that last bit)
  • The hammer just came down, tweeps: ESPN memo prohibiting tweeting info unless it serves ESPN.” – Nigel Barlow asks if ESPN's 'not on our dime buddy' take on social media will become the norm. I hope not.
  • WSJ’s New Policy: Won’t Take Herd Embargoes – Paid Content takes the announcment that the WSJ will not take embargos and links it with the policy of measuring their output on the wires. News as commodity according to Robert Thomson "Even a headstart of a few seconds is priceless for a commodities trader or a bond dealer". Is This is what breaking news on the web really means in the new world of newspapers?
  • 20 + mind-blowing social media statistics | Blog | Econsultancy – Including great presentation throw-aways to freak out exexutives like "if YouTube were a country, it would be the third most-populated place in the world." or "Every single month, more than a billion photos are uploaded to the [facebook]."
  • Video Views on Msnbc.com Mobile Properties Climb; Mobile Video Viewers Prefer the Phone for News – Lots of interesting stats but bare in mind that the survey only asked people who already get video on their mobile.
  • Local online news video: What’s working and what’s not in content | Online Journalism Blog – Vadim Lavrusik looks at what is working and whats not in US newspaper video. Interesting start to a three part series
  • Augmented Reality Twitter is the Coolest Thing Ever – "TwittARound, an application for the iPhone 3GS that uses the GPS, compass and camera to show where Tweets are coming from. " And there is some fantastic video to prove it. Must resist 3GS buying spree
  • Journalists Are News Companies’ Most Valuable Asset – Publishing 2.0 – Using Politico as an example Scott Karp thinks about the shifting power of the journo in not only producing but also packaging the news. "does focusing on journalists as news companies’ most valuable asset mean that news companies should be exclusively in the content production business? That’s a significant shift from the industrial printing and distribution business." Of course this idea needs developing as it treads perilously close to the "only work for online journalism" trap. But nice thinking none the less
  • What would you do with a journalist? « Talk About Local (alpha) – Very interesting article and one that offers good advice. "So if you run or contribute to a hyperlocal website, forum etc imagine waking up one day to find a nice shiny shrink-wrapped journalist on your doorstep with passable modern media skills and all the classic attributes a journalist should have (I said ‘imagine’ not all journalists are NOWesque in the same way not all hyperlocal bloggers are foaming mad Sid Nutters). And imagine that journalist is yours for say a day a week or can work with a herd of local blogs over the week. What would you do with them?"
  • What the F**K is Social Media: One Year Later – Great presentation – social media is like teen sex….or is it
  • Sly Bailey attacks BBC plan to share web video – "We are interested in real partnerships. We did not see that in what this [deal] offers, we are not here to build the BBC brand for them," said Bailey, speaking to MediaGuardian.co.uk." In other words, show me the money.
  • Introducing GrowthSpur - – Recovering Journalist Mark Potts introduces his new venture, Growthspur. Backed by his experiences with backfence he hopes "The company will provide a suite of tools and services that will take a lot of the guesswork out of starting or running local sites and turn them into successful, sustainable businesses" This involves a no profit no pay model of support and training for hyperlocal sites. Nice idea. Silo the knowledge of journos and make it pay where everyone can see the traction – local ads.
  • Crucial reading on the evolution of news, as it stands today – Invisible Inkling – Ryan Sholin pulls together some of what he thinks "would be the most important footnotes in the Summer 2009 chapter of the book someone surely must be writing at this point, here are some recent favorites:"
  • Video Watching Now More Popular Than Social Networks – A new survey reveals, amongst other things, an Interesting angle on everyone is watching on PC .."on the cord-cutting myth front, Pew says that of the 22 percent of American adults who have cut back on their television subscriptions in the last year, 32 percent say they’ve connected their computers to their TVs to watch web video."
  • NewsInnovation videos from @newsmatters: – Judith at Journalism.co.uk has been working like a demon with the old cut and paste of google embed to bring this great round up of video featuring @kevglobal, @currybet, @markng, @simonw, @willperrin talking about all aspects of the media. The video with Martin Moore and Mark Ng of the Media Standards Trust talking about their project with the AP might be interesting in the current circumstnces.
  • Local newspapers in peril: The town without news | The Economist – Thanks to Jo Geary for pointing me to this cracking article (and comments) about the impact (or otherwise) of the death of local newspapers. A really interesting read
  • AOL Newsroom Now Has (Wow) 1,500 Writers – Techcrunch continue a bit of an AOL series with the news that "AOL now has 1,500 people writing content across its scores of content sub-brands, we’ve confirmed. Around 1,000 of those people are working full time for AOL, the rest are freelancing. " A lot compared to some. Minor leagues compared to others. That said AOL could prove an interesting model for critical mass content producers – just big enough…
  • Newspapers on Twitter – how the Guardian, FT and Times are winning | Online Journalism Blog – "National newspapers have a total of 1,068,898 followers across their 120 official Twitter accounts – with the Guardian, Times and FT the only three papers in the top 10" That and a whole load more interesting facts about newspapers on twitter
  • Twitter Drives Traffic to Media Websites – "Micro-blogging site Twitter has become a key source of traffic to other content-driven websites, including news and entertainment ones, Hitwise reports."
  • Who needs newspapers when you have Twitter? | Salon News – Long Tail and free, Chris Anderson starts out obtuse but raises some good points in this salon interview
  • Q&A: Nick Bell on the opportunities offered by online video – The man at quickTV and his advice on video "be clear about your objectives, whether advertising or otherwise: consider what footage you already have and whether a re-edit or more is needed. Then, make the clip web-ready to optimise engagement, response rates and accountability, through the interactive and dynamic features that are currently available. Finally, publish wisely and try not to become too complacent when you see the great results start coming through… "
  • MSN Wants Local Papers’ News Feeds | paidContent:UK – MSN go hyperlocal and have their eyes on broader content – "The site’s executive producer Peter Bale tells Telegraph.co.uk: We are hoping to take feeds from local newspapers and tag every piece of information to a map. Hyper-local news online has never been more important and we think this is a really interesting growth area.” " Wonder if the regionals will think the same.
  • Opposition to BBC’s newspaper video-sharing plans grow (the links) – Laura outlines the reaction to the Beebs new video plans
  • Computer Assisted Reporting – James Ball with another take on recent crowdsource journalism project Help me investigate – "It would be a crying shame if the brilliantly intentioned – and rather nicely executed – social journalism project that is HMI actually ended up stifling a fledgling journalistic field. Maybe I’m far too negative. But it does seem the risk is there."
  • Eleven-word snippets can infringe copyright, rules ECJ – I appreciate that in bookmarking this I'm risking a lawsuit. But what the hell."The copying and reproduction of just 11 words of a news article can be copyright infringement, the European Court of Justice (ECJ) has ruled. Europe's highest court has said that a clippings service's copying could be unlawful."
  • Media: National Public Radio’s Digital Makeover – Vivian Schiller talks about the changes at NPR but it's here take on philanthropic support for journalism that caught my interest. A worthwhile read all round
  • Toy Chest (Online or Downloadable Tools for Building Projects) – simon willison pointed me to this wiki site with a whole load of great apps and sites for mashups, visulisation and more
  • Hack Day tools for non-developers – "We’re about to run our second internal hack day at the Guardian" says Simon Willison and he is crowdsourcing ideas for tools for non-developers to use. As is often the case, the crowd comes up trumps.
  • The Nichepaper Manifesto – Starting with the unarguable "Journalists didn't make 20th century newspapers profitable — readers did." and ending with "Nichepapers, in contrast, do meaningful stuff that matters the most. The great failing of 20th century news is that monopoly power became a substitute for meaningful value creation. At root, that's the lesson that newspapers are learning the hard way." Umair Haque sets out his manifesto for what a nichepaper actually is with ome good examples along the way
  • Is Crowdfunding the Future of Journalism? – Leah Betancourt has a great "lay of the land" style article on crowdsourcing, funding, charity and more as models to sustain journalism
  • Why Comments Matter – "Keep the comment threads at the end of news stories. But doing that is not enough… you need to have your journalists participate actively in the discussions. If you do all of that, you can host great discussions at the end of your news stories and who wouldn't want that?"
  • How to: write the perfect press release for journalists – Journalism.co.uk offer a "crowdsourced guide" to writing the perfect press release
  • Not-for-profit news deep in the heart of Texas | News Innovation – A round up of views on not-for-profit newsrooms off the back of "the announcement that the Texas Tribune acquired the Texas Weekly, a subscription newsletter devoted to Texas politics and government".This continues to underline my feeling that philanthropy is the overriding business model in the US. A divergence point for the UK/US watchers
  • Social Journalism: Curate the Real-Time Web – "What’s Social Journalism? It’s what you do when you gather information in social media channels and then report it to your readers" – Journo link tool Publish2 announce more focused social media aggregation for their site. They call it a "HUGE value creation opportunity."
  • 22 futures of journalism, 2009 timeline – The almighty link has "a timeline of 22 articles and blog posts from this year that contain some idea about what the journalism will look like in the future." An interesting set of articles and an intersting way to display them
  • BBC will share online video with papers – Press Gazette – The nationals get first bite of this (limited) cherry. My thinking is that they should have done this the other way round and talked to the big regionals where, for once, there centralized IT could have worked to allow a quick roll-out. Perhaps the regionals are just too commercial?
  • Template Twitter strategy for Government Departments – Government advice on twitter made available in "a generic template Twitter strategy for government Departments." Interesting stuff
  • It’s Twitter time – right now! – Be excited. The ever generous 02 have allowed us to use text messaging on twitter (thanks for that guys) How to set up twitter on your 02 mobile.
  • BBC guidelines for Embedding video on external sites – In the light of the BBC's announcement for video sharing with some newspapers here are their guidelines on how you can use their content
  • The future of video blogging – @documentally thinks this could be the future of video blogs. I'm not sure about that. It's technology I've seen before but the existence of Google's street view gives it the contextual hook that people now 'get it'. This has real uses (and causes some issues) for news 'reporting' show the whole scene. – ultimate visual transparency.
  • Advancing the Story Doing data online – Deborah Potter looks at the Data Bay, an effort by Florida TV station WFLA-TV and the Tampa Tribune to do a bit of a Guardian Data store (or, to be fair, vice versa).

Fancy category list plugin for wordpress

An updated version of the plugin is now available with the links fixed

I’m in the process of putting together websites for the students to use this coming academic year and one of the things I wanted to try was a beatblog similar to the Everyblock style of site. So I’ve been playing around with wordpress and various plugins to build a site that is organised by ward and displays stories on a map. The idea being that it gets students playing with tags, geotags etc as well as helping them see how this kind of thing can be helpful for finding stories within their community (a skill much desired by the industry)

I’ll post more about my thinking and the practical process of the site as it beds in. But in the process of putting the site together I had a go at building a plugin (extra functionality for wordpress) which I thought I would share.

I’m a fan of the layout of Everyblock. It’s a great design. I particullay like the way they display the number of posts as a percentage of the total in a section with a neat bar graph kind of thing. It’s a quick way to pick out busy sections.

A visual guide to popular sections

A visual guide to popular sections from everyblock

So I thought ‘I’d like a bit of that kind of thing on the beatblog’.

With a bit of digging around I found a great tutorial by Wilson Miner, designer and co-founder of EveryBlock, on how those lists where made using CSS and ordinary html lists. Worth a look.

Having got it working within WordPress (a good deal of template bashing later) I thought it would be a perfect snippet to try and make in to a widget so that I didn’t need to hard code it in to the pages. Which, thanks to a great tutorial by Tim Trott on how to make wordpress widgets, I have done.

The fancy category list widget

The fancy category list widget

And in the spirit of these things,  here it is for you to try if you want to.

You can see it in action here (warning:this site is under development so don’t be alarmed if it looks odd)

How to install

The file contains a folder called fancycatlist. Put the whole folder and its contents to the plugin directory of your wordpress isntall and then activate the plugin in your wordpress back-end.

The folder contains two files. The actual plugin file (fancycatlist.php) and the style sheet that does most of the layout work for the list (fancycatlist.css). If you want to make major changes to the look and feel it’s the css file you want to be tweaking

Once it is installed you’ll find that you have a new widget called Fancy category list.  It’s meant to be used in the sidebar.

Settings

The widget has a number of settings

  • List title: This appears above the list in the Leave it blank and nothing is displayed.
  • Parent category ID: This restricts the list to show the categories in a parent category. So in my install I have all the ward categories under a parent category called Wards. Leaving this blank will list all the categories on the site that have a post assigned. Empty categories don’t show up.
  • Style information: These boxes allow you to customise some of the look and feel. You can change the colour of the category text, the bar behind , the number of posts and the roll-over colour.

Pretty straightforward I think.

The result is something like this

The fancy Category list

The fancy Category list

How it works

The plugin works by counting the number of posts published on your blog and then working out what percentage each category accounts for to generate the bar.  It then generates a standard list of the results and applies the CSS required to make it look nice. So the truth is that its not entirely accurate to the section (especially if you use the parent setting) but I needed a ‘grand total number’ to work with.

What’s next

To be honest probably nothing. If I was to take it any further it would probably be to give the option of it displaying little sparkline style graphs. It could also do with setting up so that you could have multiple instances of the list and a few more settings. I’m also sure that the CSS would have some proper hackers spinning on their chairs. But it works for me and it looks not-to-bad on most installs.

If you get some use out of it or change it, let me know. It may not say it in the files but the stuff is there for you to do with what you will. If you make millions off of it then rememeber me in your will.

Notes etc:

Notice I said ” can be helpful” when talking about using the web to help cover communities. I don’t think it’s a replacement. No one in their right mind does. So please don’t hassle me about killing traditional reporting.

If enough people are interested I can write a post about how I made the actual plugin. But I have to say that everything I learned came from Tim’s post.