P2 Theme gets an upgrade: say hello to Custom Menus and To-Do List Support

Today P2 Version 1.4.0 has been released – hurra! Thanks for everyone’s hard work on this amazing theme.

P2 now boasts a couple of extra options and plenty of changes under the hood, but like many other great features those are not immediately obvious. Let me show you how the new changes work and how they can make your P2 experience even better.

To-Do List Feature

The latest and greatest addition in Version 1.4.0 includes the To-Do List feature. With it you can write lists of things you and your team need to do, and have a record of the things that you’ve already done. Here’s what it looks like in action:

You can create those by putting each of your to-do items on a separate line and starting it with either a small letter x (for ticked) or a small letter o (for unticked) like this:

To change the state of an item, users can simply tick or untick the boxes, and upon page refresh the system will add a strike-thru with a user mention behind the list item (or remove it respectively).

Note this does not work for all user roles though – here’s a list I’ve compiled (thanks to a question from Tevya – otherwise I would have neve found out about this cool feature):

  • Subscribers and Contributors – can write to-do lists, but can neither tick their own nor other people’s boxes.
  • Authors – can write to-do lists, can tick their own, but not other people’s boxes.
  • Editors and Admins – can write to-do lists and can tick other people’s boxes.

Without the page refresh the tick is there and the system will save it but the mention and strike-thru won’t be visible. I find this feature incredibly useful.

Custom Menu Support

Another great new 1.4.0 feature is the support for custom menus, including drop-down child item support. It’ll be displayed between your header and your content:

Now we have custom menus in P2 - sweet!

You can create your own menu under Appearance – Menus in the WordPress backend.

Under the Hood: introducing Custom Post Formats

Prior to this version of P2, the posts you created from the front page were automatically filed into one of four categories: status, post, quote and link. I’ve explained how to change those to your own requirements in this article.

Here’s a familiar site for P2 posts in versions 1.3.3 and prior:

P2 v1.3.3 and before used Categories to store your different updates

Version 1.4.0 utilises WordPress Custom Post Formats instead. This means that no matter what you select at the top, everything is posted in your default category (defined under Settings – Writing). Now each post is saved as a custom post format – apart from Blog Posts which are just standard posts:

P2 v1.4.0 uses Custom Post Types instead

This means of course that if you’ve amended the theme with your own labels and categories, this tweak will no longer work. As soon as we figure out how to override this in Version 1.4.0 I’ll let you know.

Link Styling

Remember the link option that never really did anything? The one that used to confuse everybody? Looks like the team have given it some styling – now it looks just like a Quote with a blue highlight:

New Santa Background Texture

Christmas time is here

Christmas may be a while off yet, but time melts away like he snow in the sun. When the time is right and you want to add a bit of Xmas Pazazz to your P2 site, head over to Appearance – Settings and select Santa from the list of included backgrounds.

Writing Lists with Bullet Points

On the note of To Do lists, the “standard lists” feature has been around for a while, so I thought for completion I’ll mention it here.

You can create what’s known as “unordered lists” in HTML. Those are the ones starting with bullet points like in this example:

 

You can write those in a similar way as the to-do lists, just by placing a minus sign in front of each line:

 

Even though writing those is simple, editing those is a little bit more complex. The way P2 creates the list is by replacing each “-” and wrapping the entire line in HTML code needed to display those bullet points. If you hit the EDIT button here’s what your list looks like:

 

A brief explanation: an unordered list starts with <ul> and ends with </ul>. In between, each item starts with <li> and ends with </li>. So if you want to add an item retrospectively to your list, wrap your line in those <li></li> tags and put them above the closing </ul> tag.

Alternatively, you can always visit your WordPress back end and edit the post in the visual editor.

Further Reading

About Jay Versluis

Jay is a medical miracle known as a Super Survivor. He runs two YouTube channels, five websites and several podcast feeds. To see what else he's up to, and to support him on his mission to make the world a better place, check out his Patreon Campaign.

33 thoughts on “P2 Theme gets an upgrade: say hello to Custom Menus and To-Do List Support

  1. Your previous articles on p2 very helpful. Many Thanks.

    but changes in 1.4 appear to mean that front end “category setting” is no longer possible.

    Prior to p2 1.4 it was possible to have another input tab (say “Alarms”) so that the input choices were “Status Update – Blog Post – Quote – Link- Alarms”
    ( a la your articles)

    This could be achieved by adding

    <a id="alarms" class=”selected” href=”” title=””>

    to in post.php

    and adding “alarms” to the $accepted_post_cats in ajax.php

    so if somebody clicked Alarms and inputed something in the input box it was recorded in Category Alarms.

    I appreciate that post_formats is the way to go But how can I incorporate the above functionality (kind of front-end category setting – set post categories??) in p2 v 1.4.?

    Any ideas very welcome.

  2. @Valuser, I believe P2 switched to using post formats for this a few versions ago. It’s not using categories but rather post formats. So there should be a way to add additional formats, it’ll just be a little different than adding categories. See here: http://codex.wordpress.org/Post_Formats

    @Jay thanks so much for your great info! Can other users check off things on a checklist? And do they remain checked for all? Or does the original poster, have to go in and change the o to an x? Thanks.

    1. Hi Tevya,

      Actually Custom Post Types is a brand new addition to this version of P2, the previous version 1.3.3 was still using categories. I’ll amend this post accordingly.

      As for to-do lists, they can be changed by any user with access to global post editing capabilities. Only Admins and Editors can edit other people’s posts (and hence to to-do lists) but Contributors, Authors and Subscribers cannot. They can however edit their own posts.

      1. Thanks for answering Jay. Hmmm… guess I was confused on the categories thing.

        As for the to-do lists, what I’m asking is can you just check the check box? And will it stick for in the future and all other users to see? As opposed to editing the post and changing the o to an x? And if you can just check the box, can other users do so as well? Thanks.

        1. That’s a great point – I hadn’t tested this until just now. I was under the impression that those tick boxes were just visual representations but they’re not: they’re fully working and hence even more useful! So to answer your question: yes they can be ticked by other users on the site, depending on their user role. Here’s a list I’ve just experimented with:

          • Subscribers and Contributors – can write to-do lists, but can neither tick their own nor other people’s boxes.
          • Authors – can write to-do lists, can tick their own, but not other people’s boxes.
          • Editors and Admins – can write to-do lists and can tick other people’s boxes.

          When user1 ticks user2’s box he needs to refresh the page to see the strike-thru as well as a mention of his name behind it as an indication who did it. The box can also be unticked and upon refresh will remove the strike-thru and the mention. Without the page refresh the tick is there but not the mention. I’ll update the article with this new find 😉

        2. I don’t know if it’s possible because of the way WP set’s permissions, but we should petition the P2 people to make it possible so subscribers and contributors can check both their own, and other people’s. Or make some kind of setting for it like the “anyone can post” option. In my opinion it would make P2 much more powerful, if people can collaborate on lists like that.

        3. I hear you, that would be very cool – a bit like the P2 Resolved Posts plugin which does not check if it’s your post or not. In fact, that plugin doesn’t even mind if you’re not a registered user at all.

          I’ve had a look at the P2 code and the file responsible for lists is inc/list-creator.php. In it P2 checks if the current can edit the post (line 72) and hence change the tickbox state:

          function current_user_can( $post_id = 0 ) {
          return current_user_can( 'edit_post', $this->get_object_id( $post_id ) );
          }

          You can amend the last line to always return true, therefore every user will be able to tick and untick those boxes:

          function current_user_can( $post_id = 0 ) {
          return true;
          }

        4. Hmmm… Good to know. I hadn’t heard of the P2 Resolved posts plugin. So would it be possible to make a plugin that does a similar thing with the checklists? Like the modification you describe, but rather than modify the theme files, just put it in a plugin?

          I’d prefer they had to be users, and logged in, for them to be able to check the check-boxes, but I’d just like all levels to do it. And/or define a lowest level that’s able to check them on other people’s posts.

        5. Yes the trouble with theme modifications is always that when the new version comes along all your customizations are history. Not ideal, but on the other hand, it is only a one-line tweak and does exactly what you’re asking for.

          The Resolved Posts plugin introduces a new element into the theme (a red/green stripe on the left hand side of the post) and as such has full control over who can change it. The to-do lists on the other hand are part of P2 and hence they rely on P2 functionality – I’m afraid it’s beyond my abilities to re-create the same feature as a plugin. You’d basically have to rebuild how P2 creates those elements and then use a different shortcut to display the lists. The list-creator.php file is well documented and can serve as a good starting point. If you do make progress on that front though, do let me know.

  3. Hi Jay – thanks for great article and here’s hoping your thread will inspire new workout for the categories as option vs post types … ugh – i love upgrades but hate when things dramatically change and force entire new logic … with 1.3.3 i had beautiful category drop down that worked like a charm (per your previous code to modify core p2 inc/ajax.php and js/p2.js files along with tweaks to child theme) … but after spending two days now struggling to get that code to play nice with new 1.4, i’ve realized (per comments here) that my efforts are hopelessly in vain given the new use of post_formats vs previous method … oh well, nobody likes complainers so i’ll role back and stay with 1.3.3 … but will keep my fingers crossed that a new work out might be forthcoming … viva the power of open source and community that shares … again, thanks for thread and info … cordially, chuck scott

    1. That’s the spirit 😉

      I have the same problem, I need to rethink my logic for customisations on this theme too. I have yet to figure out how to query custom post types – it was really easy to bring up all posts in a category with 1.3.3

      Like you said, we’ll come up with something. Let’s keep the lines of communication open.

  4. Great write-up — this is the exact info I was looking for. Thanks!

    FYI — you refer to Custom Post *Types* — are these actually Types, or are they Custom Post *Formats*? It would make more sense for them to be the latter.

    1. @Matthew
      I think I understand your question now. P2 uses the predefined WordPress post formats rather than custom post types. There is indeed a difference: custom post types can be defined by a theme, whereas post formats can be used without having to be defined first. The downside is that we cannot add to the current post formats as P2 uses them, we can at best choose from a list of formats we’d like to add.

      See http://codex.wordpress.org/Post_Formats

  5. Hi Jay,
    I’m running a child theme against P2 version 1.4.
    I just added a sidebar for my help page and it works great but now my default P2 sidebar doesn’t want to show ??
    Any ideas on that?
    thanks
    Ray…

Add your voice!