To keep this post short-and-sweet, which will be the aim for future articles, I am experimenting with the Situation, Task, Action, Result (STAR) method for this write-up. Do let me know if you think it works or not in the comments or the contact form.

Situation

A TablePress table listing sport fixture results (e.g. football, hockey etc.) requires regular updating.

This had been done by one person using an (offline) Excel spreadsheet and manually importing the .csv file. But the job has now been shared amongst a team of three (in different locations), so maintaining an offline spreadsheet no longer seemed practical.

Thus it made sense to create and maintain a single version on Google Sheets that could be edited by all.

But exporting and importing the file requires extra action. Could this process be automated?

Task

Automatically and periodically import a Google Sheet into TablePress to replace a table of fixture results

Action

  1. Download, install and enable the TablePress Automatic Periodic Table Import extension. Please note this is a premium plugin and so I would strongly encourage you to make a donation to Tobias Bäthge if you find it useful (the current recommended amount is $18).
  2. Login to Google Docs and open the sheet you wish to export.
  3. Click on File → Share → Anyone with the link can view to ensure the extension can access the sheet; simply enabling File → Publish to the web does not always work for the .csv format as this only makes the HTML output public, but not the .csv version.
  4. Copy the URL of the sheet, which should have the following format (where YOUR_DOCUMENT_KEY is the primary ID of your Google Sheet):

    https://docs.google.com/spreadsheets/d/YOUR_DOCUMENT_KEY/edit?usp=sharing

  5. Paste the URL into the Source field for the relevant table and replace:
    edit?usp=sharing

    with

    export?format=csv
  6. The final format is as follows:

    https://docs.google.com/spreadsheets/d/YOUR_DOCUMENT_KEY/export?format=csv

    UPDATE with props to Alessandro: The above will import the first sheet (‘Sheet1’) or gid=0 so if you are looking to import a specific tab/sheet in a multi-sheet document, you will need to identify the GID=YOUR_GID_KEY reference and include it in the url.

    The final format of a specific sheet is as follows:

    https://docs.google.com/spreadsheets/d/YOUR_DOCUMENT_KEY/export?format=csv&gid=YOUR_GID_KEY

  7. Click the check-box to activate the Auto Import, set how frequently this should occur and save changes.

Result

A single online spreadsheet hosted on Google Docs/Sheets editable by multiple authors, which is then automatically and periodically imported into TablePress to replace a table of fixture results.

Demo: https://www.wpsnippets.com/tablepress-auto-import-using-google-sheets/

References

Tagged with: , , , , , ,

And if it wasn’t for my exams, I would have picked up on this news earlier… who would have thought? 🙂

http://www.wptavern.com/secrets-revealed-wltc-and-wptavern

Personally, I am very glad to find out about this revelation – it shows the right people still care enough about the community:

Why on earth? Well, it’s the same and different for each one. Jeff wanted to step back from WPTavern and had an offer but I thought it wasn’t really fair given the years and effort he had put into the blog. Even if he wasn’t going to be part of the WordPress world anymore I wanted him to go out of it with the best deal possible. For Mark, the context was similar except I don’t think he talked to any other buyers because his priority was having it in good hands – someone who would keep it around. I have a high regard for the great historical context WLTC provided, being there with WordPress from pretty much day one. So each was purchased by Audrey and went into hibernation.

Neither was done to be a business or make any money and there are no plans for ads or sponsors on either site.

So there you have it, WLTC will become a credible and worthy archive celebrating the history of WordPress (which is now in its tenth year)  and WordPress Tavern will become, hopefully, an alternative community hangout outside of WP.org.

Tagged with: , ,

Having worked with child themes for some time, it was great to learn something new today, one that will cause a paradigm shift in the way I work with themes. The epiphany came from Dave Clements, who built on Ryan Mel‘s WPCandy article How to create your own WordPress functionality plugin and essentially tells us to use a plugin to introduce custom functionality instead of putting (most) of the code into the theme functions.php file.

The basic premise is this:

Create custom functionality for your site but don’t tie it down to a theme

What do you mean?

To clarify: we all know what happens when we switch themes – custom taxonomies disappear, shortcodes cease to be of use and Favicons are no longer – unless we build them in, again.

Why waste time and energy doing this when you can retain all these by creating your own custom functionality plugin?  Then you or your client can switch themes at will.

Then when should I use functions.php?

Both Dave and Ryan maintain that not everything should be put into the plugin; some things should still remain in the theme file’s functions.php, for example registering sidebars and custom nav menus, which are specific to your theme.

Others, including custom image sizes are more open for debate and will be up to your discretion.

Ryan produced a helpful table to provide some examples, reproduced below:

Screenshot of comparison table for when to use a functionality plugin vs functions.php

More content is available by clicking on the image or link above, which will take you to the full article (with even more discussion and recommendations) but hopefully this gives both you (and me) a better idea of what to put in our functionality plugins.

So how do I create a custom functionality plugin?

It’s as simple as taking the relevant codes from your functions.php and placing it into a plugin-name.php file. Both articles – WPCandy and Dave – kindly provide blank templates, and Ryan (on WPCandy) actually goes a step further to advise maintaining a readme.txt file.

I have not included a blank file here since that would be duplicating the good work done by both; direct file linkage is not ideal either.

Effectively, much like a style.css file, the header in your plugin-name.php is very important:

/*
Plugin Name: Site Name Functionality Plugin
Description: Summarise the key elements of your site functionality plugin.
Version: 0.1
License: GPL
Author: Your Name
Author URI: Your URL
*/

This file then goes into /wp-content/plugins/plugin-folder-name. Then you simply activate your new custom functionality plugin.

Further comments

It might be reassuring to know that heavy weights like Otto, Michael Fields, PTah Dunbar and Konstantin Obenland have all stated in the comments that they agree this to be good practice and some of them use it on their own sites.

Dougal Campbell also suggested the following:

If I switched themes, and this functionality disappeared…
…would I miss it?
…would it ‘break’ my site in some way? (I’m using ‘break’ loosely here, subject to interpretation)

If I installed this theme on somebody else’s site…
…would they need this?
…would it expose any of my account info?

Last but not least, Justin Tadlock also wrote a post about this as well and advises us to ask ourselves two questions:

Is this something I only want to happen when using my current theme?

Is this functionality I want to keep regardless of the theme I’m using?

Tagged with: , , , , , , , , ,

His Jeffro-ness has recently started writing new articles again and today, he wrote about a new guide written by Siobhan McKeown which is effectively the complete handbook on how to contribute to WordPress.

Titled “Sharing Your Experiences: How To Contribute To WordPress” she starts by helping us to understand why it is important to get involved, before introducing us – in turn – to the different groups that make WordPress the awesome publishing platform that it is:

WordPress Contributors (Source - How to Contribute to WordPress by Siobhan McKweon)

A bunch of WordPress Contributors
Source

  • Core
  • User Interface
  • Mobile
  • Polyglots (that’s language translation to you and me)
  • Support
  • Theme Review
  • Plugin Directory
  • Documentation
  • Events
  • Accessibility
  • Community
  • BuddyPress and bbPress

We learn about why each group exists, who is leading it, the challenges they face and bullet-pointed steps on how to get Involved. Suddenly it all felt like a really straightforward process!

Siobhan, a professional WordPress copy writer who (also) hails from the UK   – we’re on the same techtonic plate, my claim to fame! – took the time to humanise the work behind WordPress by talking to each team lead to find out their perspective and what their motivation is on contributing to this open source initiative.

For instance, Helen Hou-Sandi (UI lead) had this to say:

“I love the community, and I think that the basic premise that WordPress is built on — democratizing publishing for everybody — is a really important one.… The premise that it’s making content management and creation easier and more accessible for more people was something that I loved, and altruism wins out.”

It was also nice to be able to put names to faces, including the Mattinator (Matt Mullenweg) who sagely said:

“Remember that everyone who’s involved at WordPress started where the people who are reading this article are today, including myself. It looks big and scary. The first time someone said to me “You should patch that and put a diff on SourceForge,” I was like, “I don’t know what half the words in that sentence mean.””I had to figure out patches, I had to figure out what a diff is, I has to figure out what SourceForge is. We all started there. You’ve just got to dive in.”

If that isn’t motivation enough, the article itself certainly does make you want to get up and take action: by the end of it, not only had I learnt about how to participate, the Doc group’s Handbook initiative, and the existence the Accessibility group and Accessites.org,  I also found I had an extra 6 tabs open from clicking on the various links to see how I – someone with limited capabilities compared to the Ottos and Scribus of this world – could help out.

Go and read the article 🙂  Personally, I don’t even want to think how long it took Siobhan to compile and write-up – it is overwhelmingly comprehensive yet an absolute joy to read.

Tagged with: , , , , , , , , ,

I recently developed a site for a client using the excellent Responsive theme as a basis. As a result, I ended up joining the Responsive Free support forums, where the CyberChimps staff offer free CSS support for the theme.  It’s a great community with some clever, warm and friendly people and I very much enjoy being a part of it.

Screenshot of Responsive Theme Free Support Forums

Responsive Theme Free Support Forums

Most of my work is now based on this theme and thus, it seems right to switch over to it on WPSnippets.  Over the course of time (probably months) I will gradually start customising it with a child theme. What this means for readers is that future WordPress tutorials and tips articles will be particularly helpful for those using Responsive.

Tagged with: ,