Well, that explains some of the missing form data, I suppose.
I've read lots of articles about unit testing PHP code, but never really 'got it' until recently. I wrote this post as a practical guide for testing your code, how to test, what to test and what to do if you can't test.
I’ve lost count of the number of posts I’ve read about unit testing; how to set it up, why you should do it, and what tools to use. It’s something I’ve been pushing myself to do and get better at but I’ve always struggled to translate what I’ve read about testing into writing tests for my own code. However, recently I feel like the principles I’ve been reading about are finally clicking in my brain and I’ve actually been able to successfully write unit tests for my code, including legacy codebases that I had previously thought were untestable. Recently, I’ve been working on changes to the internal plugin that extends the WooCommerce API on the Delicious Brains site. Previously the plugin had no unit tests and was a large, messy class with all the functionality stored inside it. The plugin allows our premium products to communicate with WooCommerce on the site for licensing and subscriptions and therefore extremely critical to our business. Before making large changes I decided to get some tests written, as well as perform some necessary refactoring. This post will serve as a practical guide to writing unit tests – what to test
Folks, I have released yet another open source project. A Gutenberg Boilerplate to build Blocks! I have written an extensive post about it, in the post I have also share my thoughts on the Gutenberg Editor, the dependency hell, license paradox, and stuff. — Have at it!
Gutenberg is all that you hear about in the WordPress community nowadays. Everyone is writing articles on how they feel about Gutenberg. I was one of the early adopters and contributors in the Gutenberg project. I have had been writing about it (invitation to contribute) and covering the meeting notes for the project. When folks started writing about Gutenberg I wanted to do the same, but I was on vacations, visiting my parents, and enjoying Eid holidays. But that’s not all; I stopped myself from writing anything because I have been a bit confused.
I am still making up my mind with how Gutenberg will fit in the WordPress core. There are so many things which are both good and bad about it. So, instead of ranting about it, I wanted to do something more productive. And I went ahead, studied the source code, received a lot of help from Gutenberg contributors (Matias Ventura, James Nylen, Riad Benguella, Andrew Duthie, Joen, etc.) to finally build a Gutenberg Boilerplate project.
Have you ever wondered what all the Webpack fuss is about? Well we’ve got you covered! In this post Peter goes over how to configure Webpack 3 for WordPress plugin development and lay the groundwork for a React-powered wp-admin page.
What is Webpack Anyway?
For example, with the style and css loaders you can
Chatbots are becoming more and more relevant these days, with large companies hopping on the bandwagon in an effort to cater to audiences who are more at home on Facebook Messenger than they are in Gmail. Well, Jeff jumped on the bandwagon as well and started hacking together bots using WordPress as their backend. He's even put together a plugin that will help you start writing bot code in just a couple of minutes without having to wrestle with Facebook’s APIs.
Bots are all the rage these days. They call us while we’re eating dinner, they merge our data for us, they take part in our elections, and they’re taking over Facebook Messenger. As a wannabe bot creator myself, I couldn’t resist the hype any longer, so I started tinkering with Facebook’s Messenger Platform to see what it would take to start chatting with my own code. Introducing WPFBBotKit
Messenger Platform is essentially just a JSON API and like many APIs, I found that there’s quite a bit of boilerplate–the digital equivalent of handshakes and small-talk–required to get started. So rather than put you through all of that, I decided to create WPFBBotKit, a WordPress plugin that will get your WP-backed bot ready to chat as quickly as possible.
One major caveat before we get started: We will not be creating “smart” bots. While it’s definitely possible with NLP and Deep Learning, we’re just going to make a simple bot that will try to drive traffic to our website by giving users something to read.
To get started, we’ll need a WordPress site with SSL support since the Messenger platform requires an HTTPS
Not just a nice little plugin to help with search engines, but also a nice example of how the WordPress community works.
Last week, I saw a tweet that identified a challenge for the WordPress UI: I REALLY wish this was easier to spot on WordPress installs. So many sites are launching with privacy enabled https://t.co/X12J8tdYVy
I wasn't alone in seeing this as an issue that was worth solving:
Knowing that plugins are best when they are built and supported by teams rather than individuals, Norcross and
I started collaborating (though in the end, the majority of the code was written by him). What we came up with a plugin to improve the experience for site creators. As the responses to Mr. Williams tweet shows, It's very common to mark a site as inaccessible to search engines and then forget to uncheck that setting when it comes time to launch.
Download BRAD TODAY
BRAD aims to solve this by moving the notice about search engine discouragement to the top of the dashboard. It also becomes a recurring dismissable notification.
Every week, there is a check to see if the site is still hidden from search engines, and if it is the notice comes back
If you change the siteurl or home options, then the notice comes back (note, you need to change these via the UI or via wp-cli, directly changing the DB)
BRAD is already
Beyond a site's main navigation menu, little touches can be added to make a website easier to navigate. Here are some code snippets you can use to bring some extra ease of use.
One of the great things about WordPress is the ability to reuse snippets of code over and over again within your themes. With that, you can build in ways to make websites easier to use. In this article, we’re going to explore ways to enhance secondary navigation. In other words, navigation that is in addition to your site’s main menu. Adding these extra elements can further help users get where they need to go and discover content they may have otherwise missed.
Here are four such snippets you can use in your WordPress themes. While they’ll work as-is, it’s a good idea to add your own custom styles to ensure a perfect fit with your site.
Where to Place Code Snippets: The snippets below can be placed directly into your theme’s template files. The exact file may depend on your particular theme (check the Template Hierarchy for ideas). And, to some degree, it’s a matter of personal preference. Use them where you think they’ll best serve your users.
It may also be a good idea to use conditional statements so that snippets are only displayed when certain conditions are met. For example, you might not want a particular snippet to run on your site’s
The Headless horseman comes for you. Or.. just a quick primer on how to leverage the WP API to get/set content out of WP.
So you’ve built a static website, all is going well, but then it turns out that the client needs a small news section (which will be updated frequently). What do you do? A headless CMS might be an answer. Headless?
Headless software is software capable of working on a device without a graphical user interface.
A regular CMS, like WordPress or Drupal, has three basic parts:
a database to store content
a CRUD API to edit it (an admin panel)
a way of displaying the content — basically what the end users see
This third part though won’t be needed. What end users see will be the static website you already have, and all we want from the CMS is a way to provide the content as data, not as HTML views. The CMS will not be concerned at all about how the site looks like, it will just handle data input and output.
We’ll skip any paid and/or cloud-hosted options for a couple of reasons. Firstly, no client would accept any fees for a small news section. Secondly, in the event of our cloud-hosted CMS provider going out of business, the data might go with him. Thirdly, it’s best to learn if you can look at the internals of any code you’re using.
Shawn Hooper's presentation from WPCampus conference in Buffalo, NY. Selenium is a great tool that we use as well.
This week I had the pleasure of speaking at the WPCampus conference in Buffalo, New York. WPCampus is a fantastic conference for those in the higher education sector who use WordPress. This year I spoke about automated user interface testing using Selenium. Thank you to everyone who attended. If you weren’t able to attend, the session was recorded and I’ll update this post with a link when it’s available.
If you’re looking for the slides I used for the presentation, here you go:
Finally, here’s a few links to the software and services I mentioned during the talk:
(Photo: Closing Remarks at WPCampus 2017.)
Post gives examples of functions that are used on WordPress.com VIP to sidestep the functions native to .org
WordPress is currently used by over 30% of all websites and 59% of all content management systems. One of the major concerns that people have when it comes to WordPress is the speed! With the release of PHP 7, some of those speed concerns have been fixed. There are other solutions that WordPress developers use to get around the speed issue such as using a full-page caching plugin, using a CDN among others. There’s, however, nothing like improving the raw speed of uncached pages especially when you need almost real-time updates with the service.This is particularly useful when you are using WordPress to build something other than a static content distribution website where the post don’t change frequently. WordPress comes with a set of core functions that are globally accessible. Most theme and plugin developers rely on these function to extend the functionality of the WordPress framework. There are however a collection of functions that are not necessarily fast when used repeatedly, in other words, they do not scale. Fortunately, Automattic, the company behind the paid VIP WordPress service, has released a set of functions that do not scale properly because they are not
Another great post with thoughts and feedback on the new Gutenberg editor which is scheduled to be included in WordPress 5.0.
Several people have already posted their thoughts and impressions about the new Gutenberg editor for WordPress, to highlight pros, cons and everything in between. Here is my perspective on it. I love that it’s a solid take on introducing a much improved version of shortcodes. Shortcodes have terrible UX, especially without the Shortcake plugin (and the requirement that each plugin adding a shortcode needs to support it). Blocks require all that UI to be there out-of-the-box. Furthermore in most cases the block content will still show properly even if a specific block type is not available anymore, for example when the plugin registering it has been deactivated. There will still be some cases though where blocks require some PHP to run (for example the “Latest Posts” block), and for those blocks the problem will still persist in a way. There need to be clever “pure-HTML” fallbacks for those to still show useful content (if possible).
I love that everything is stored in the post content, so the frontend will just work out of the box without querying lots of data from other database tables (except in custom PHP blocks possibly, but that’s unavoidable).
Given the popularity of the Singleton design pattern, how comes that some developers decry it as an "anti-pattern"? Can it really be that bad? This article explains the rationale of why it can indeed be that bad and provides alternative approaches that should be used instead.
Every once in a while, when discussing software design with fellow developers, the topic of Singletons comes up, especially in the context of WordPress development. Often times, I try to explain why these should be avoided, even though they are recognized as being a “standard pattern”. In this article, I try to go over the reasoning of why the Singleton should never be used in your code, and what alternative approaches you can use instead to solve the same problems.
What is a Singleton?
The Singleton is a software design pattern that has been described in the book Design Patterns: Elements of Reusable Object-Oriented Software by “the Gang of Four“, the reference that effectively started the talk about Design Patterns as a software engineering tool.
The basic principle is that you want to ensure there can only ever be a single instance of a given class, and you provide a global point of access for it.
This is really easy to explain and understand, and for most people, the Singleton is the entry drug into the world of Design Patterns, making it the single most popular pattern.
So, given its popularity, and given the fact it is part of the reference book and was
The initial draft of the FAQ includes tentative answers to many of the pressing questions people have been asking including about meta boxes, front-end editing, theme/plugin styles, columns, and more. Well worth the read.
Gutenberg F.A.Q. What is Gutenberg?
"Gutenberg" is the codename for the 2017 WordPress editor focus. The goal of this focus is to create a new post and page editing experience that makes it easy for anyone to create rich post layouts. This was the kickoff goal:
The editor will endeavour to create a new page and post building experience that makes writing rich posts effortless, and has “blocks” to make it easy what today might take shortcodes, custom HTML, or “mystery meat” embed discovery.
Key take-aways from parsing that paragraph:
Authoring richly laid out posts is a key strength of WordPress.
By embracing blocks as an interaction paradigm we can potentially unify multiple different interfaces into one. Instead of learning how to write shortcodes, custom HTML, or paste URLs to embed, there's a common flow for inserting any kind of content that is reliable and expected.
"Mystery meat" refers to hidden features in software, features that you have to discover. WordPress already supports a large amount of blocks and 30+ embeds, so let's surface them.
Gutenberg is being developed on Github, and you can try an early beta version today from the
Everyone is now writing about their experiences w/ Gutenberg. Chris's take is a good read: he missed the goal of this thing
I checked out the Gutenberg plugin and new writing experience for WordPress – via an early plugin version. It’s clear I missed the goal of this thing. I tried the new Gutenberg writing experience for WordPress today!
Having read all the early reviews of the new Gutenberg plugin (which is still a very early release), and then reading the interview that Matt Mullenweg did with Torque at WordCamp Europe, I was excited to try it out.
What I read from Matt’s interview, which matched his WordCamp US talk last December, was that this focus on the editor experience would let us leapfrog the experiences that newbies were enjoying with Wix, Weebly & Squarespace.
Of course, there’s always mention of the nice writing experience of Medium that is always mentioned, but the target, that I thought I heard, was the other players. The folks that were spending gobs of marketing money on ads and were taking market share from the WordPress ecosystem.
It’s clear I’ve misunderstood something, but first…
Before I tell you about my experience, let me set the record straight on several things.
I believe that the number of volunteers working on this have done a great
Announced today, there are now official forms on the make.wordpress.org site. Currently 2 types of testing being looked for, each has a central feedback form.
Gutenberg is now in beta, with that comes a new opportunity for testing. There is now a testing page dedicated to Gutenberg, you can find it right here. There are currently 2 types of testing being looked for, each has a central feedback form.
Looking for other ways to give feedback? You can also write a blog post (let the editor team know about that in Slack #core-editor) or add an issue to the GitHub repository.
Your feedback and testing is really important at this stage of Gutenberg, it really does matter and help make this as good as it can be.
As it turns out, one of the benefits of building a large and complex product like Mergebot is that there are pieces of the system that we need to build for the project that might be of use to other developers. In this article, Gilbert explains how and why we built a visual editor for PHP's serialized data and how he overcame some of the challenges he faced when building this project.
I recently built a command line daemon in PHP to emulate AWS SQSD for the purposes of testing in Mergebot. As it turns out, one of the benefits of building a large, complex product like Mergebot is that there are pieces of the system that we need to build for the project that might be of use to other developers. Today, we’re launching that system piece, a free online visual editor for PHP serialized data as serializededitor.com.
In this article, I’ll explain how and why we built this “side” project and how I overcame some of the challenges I faced when building this project.
One of the things we realized would be a problem for Mergebot users is that if you had a conflict with data that had been serialized using PHP’s serialize function, trying to edit that serialized data in the “conflict resolution screen” would be a terrible experience. No one wants to edit serialized data manually, and this was guaranteed to be a problem as many parts of WordPress (including plugins and themes) serialize data when it’s stored in the database (widget settings, plugin settings etc.).
So what could we do? We wanted the user experience of merging
Long list of updates this week which should spark new feedback posts from folks for sure. Half the list is additions, most of the other half are bug fixes.
Added framework for notices and implemented publishing and saving ones. Implemented tabs on the inserter.
Added text and image quick inserts next to inserter icon at the end of the post.
Generate front-end styles for core blocks and enqueue them.
Include generated block classname in edit environment.
Added “edit image” button to image and cover image blocks.
Added option to visually crop images in galleries for nicer alignment.
Added option to disable dimming the background in cover images.
Added buffer for multi-select flows.
Added option to display date and to configure number of posts in LatestPosts block.
Added PHP parser based on PEG.js to unify grammars.
Split block styles for display so they can be loaded on the theme.
Auto-focusing for inserter search field.
Added text formatting to CoverImage block.
Added toggle option for fixed background in CoverImage.
Switched to store attributes in unescaped JSON format within the comments.
Added placeholder for all text blocks.
Added placeholder text for headings, quotes, etc.
Added BlockDescription component and applied it to several blocks.
Implemented sandboxing iframe for embeds.
Include alignment classes on embeds with
Gutenberg, Components, a new committer and more. Lots of people have been asking about the future of _s, and the Theme Team is finally publishing a status update.
The title may strike you as a bit ominous, but fear not. Underscores, our popular starter theme for WordPress theme development, isn’t going anywhere. As we continue to push for consistency in themes and imagine what they might become with Gutenberg, we’re bringing our attention back to Underscores. For the last year and a half, we’ve experimented with a new starter-theme generator called Components. It was a way to make a few different theme “types” comprised of different components. The starter themes born from it brought with them more code and styles, and gave theme authors a bigger head start in their work. The generator we built to piece the different components together got complex quickly, though. We created a plugin to test builds locally and struggled with a seamless way to make many starter themes from one code base.
We learned a lot, though. We worked on Components at two team meetups, made almost 900 commits to the project and launched dozens of themes with it. However, we hit a point where we realized we had over-engineered parts of the project. The original idea is still solid: make starter themes do more by crafting them out of building
WordPress 4.8 is out, named “Evans” in honor of William John “Bill” Evans. Grab now and bask in the glory of a fresh new release.
An Update with You in Mind Gear up for a more intuitive WordPress!
Version 4.8 of WordPress, named “Evans” in honor of jazz pianist and composer William John “Bill” Evans, is available for download or update in your WordPress dashboard. New features in 4.8 add more ways for you to express yourself and represent your brand.
Though some updates seem minor, they’ve been built by hundreds of contributors with you in mind. Get ready for new features you’ll welcome like an old friend: link improvements, three new media widgets covering images, audio, and video, an updated text widget that supports visual editing, and an upgraded news section in your dashboard which brings in nearby and upcoming WordPress events.
Exciting Widget Updates
Adding an image to a widget is now a simple task that is achievable for any WordPress user without needing to know code. Simply insert your image right within the widget settings. Try adding something like a headshot or a photo of your latest weekend adventure — and see it appear automatically.
A welcome video is a great way to humanize the branding of your website. You can now add any video
The current version of Gutenberg breaks thousands of themes and plugins (e.g. meta boxes). While this hopefully will be adjusted, it's still surprising that it was not priority in first place. Does core development have users in mind or may WordPress even have a marketing problem?
Is the Gutenberg editor what WordPress wants to be in the future? As you probably have noticed, a lot is going on at the moment and it seems WordPress is slowly trying to reinvent itself. While this is great and surely necessary to make it future proof, it also raises some questions and concerns. Does WordPress development go into the right direction? Is it clear what WordPress wants to be? Or does WordPress even have a marketing problem?
The Gutenberg approach and what users really need
The most exciting WordPress news in 2017 is Gutenberg – the brand-new editor which probably will ship with WordPress 5.0 and which currently is available as a plugin. It’s great to see that the editor in WordPress will be updated after all those years. However, the Gutenberg approach also raises lots of concerns amongst developers and confusion about what WordPress wants to be – to say the least.
There recently have been lots of posts on WP Tavern about Gutenberg and this seems to be the hottest topic in the WordPress community at the moment. While most people agree that WordPress needs to evolve, there also are disagreements of how this should be done. Today I stumbled upon a comment
Matt's been using WordPress for a while (almost 7 years!). So he decided to take a break from WordPress and check out some of the newer content management systems that have sprung up over the last few years. In this week’s article he takes a look at Craft CMS and compares it to WordPress
I’ve been developing with WordPress for quite some time now (almost 7 years), which is practically an eternity in the world of technology and software development. Realizing I’ve spent all this time with just WordPress has got me wondering what some of the other CMS platforms look like today. Some of the frameworks that were available when I first started working with WordPress have matured a lot, and there are some new players on the field that are definitely worth a look. In this series, I’ll be taking a look at some of these platforms and comparing them in several aspects to WordPress.
Since I’m looking at this from a development perspective, I’ll be focusing on the self-hosted options, which means that I’ll be leaving out some of the more popular rivals to WordPress like Wix, SquareSpace, and Medium.
To kick this off, I’ll be taking a look at Craft CMS by Pixel & Tonic, a software development team that was behind some of the best add-ons for ExpressionEngine. They have since moved on from ExpressionEngine to create their own CMS that is built on the popular Yii framework.
Craft bills itself as “a content-first CMS that aims to
Matt shares some new and recent insights on the short and medium-term path of WordPress, what the focuses are. Worth a read.
Last week we released version 4.8 “Evans” of WordPress, as I write this it has had about 4.8 million downloads already. The release was stable and has been received well, and we were able do the merge and beta a bit faster than we have before. When I originally wrote about the three focuses for the year (and in the State of the Word) I said releases would be driven by improvements in those three areas, and people in particular are anticipating the new Gutenberg editor, so I wanted to talk a bit about what’s changed and what I’ve learned in the past few months that caused us to course correct and do an intermediate 4.8 release, and why there will likely be a 4.9 before Gutenberg comes in.
Right now the vast majority of effort is going into the new editing experience, and the progress has been great, but because we’re going to use the new editor as the basis for our new customization experience it means that the leads for the customization focus have to wait for Gutenberg to get a bit further along before we can build on that foundation. Mel and Weston took this as an opportunity to think about not just the “Customizer”, which is a screen and
Say you wanted to use containers for WordPress, and say you wanted to use Kubernetes to do it.. Sprinkle on some Varnish and away you go.
Overview My goal with this post is to explore Kubernetes' Ingress Controller and Ingress resources. The best way to do that is to deploy a real application: a Wordpress site with a Varnish HTTP cache and a MariaDB database.
If you're following along, I'm using minikube (v0.19.0).
Let's dive right in. This is the overall setup we want to end up with:
The Ingress Controller is a control loop that handles inbound traffic and applies rules to deliver that traffic to applications within our Kubernetes cluster.
It runs separately from the Kubernetes master and allows you to write your own controller code. This is great because we can decouple the routing rules from our application.
Minikube ships with an Nginx Ingress Controller that you can enable by running:
minikube addons enable ingress
If you are using GCE, the controller will be an L7 Cloud Load Balancer, while on AWS you will get an Application Load Balancer (ALS). In either case, the controller listens to ingress events in the Kubernetes API and creates all the resources needed to route the traffic.
Unless you plan to write your own controller, this will be done behind the scenes. All you need to do is create
Interesting details on how The Sun was moved to WordPress.com VIP from a print-based CMS. Also new tools like a pre-set layout picker and more.
Powerful and intuitive, the WordPress editorial and content management interface is also extremely flexible. It has been customized to match varied and sophisticated workflows for enterprise media and marketing teams all over the world. Last month at the Big WP Meetup in London, John Blackbourn (@johnbillion) of VIP agency partner Human Made presented highlights of a major customization project for The Sun and its sister publications, The Irish Sun and The Scottish Sun. The Sun is the largest newspaper in the UK by circulation, and second-largest by online audience. The customization work was just one piece of a larger replatforming initiative that moved The Sun to WordPress.com VIP from a print-based CMS. This was a massive undertaking, and involved moving 10 years worth of content — 400,000 articles a terabyte of images.
John’s talk focused on the interface Human Made built to match the editorial workflow of the three publications.
Requirements and Discovery
Highlights from the Sun’s editorial requirements included:
Editors need to quickly and frequently alter the content and the layout of the home page, which can change as often as every ten minutes