Tag: wordpress

wp-config file

WordPress Debugging

It is inevitable. At some point when running a WordPress site you will have a conflict, an error, or worst case – a PHP Fatal leading to a WSOD (White Screen of Death).

My goal is to provide the means with which you should be able to view and hopefully understand, to some degree, the errors so that the most appropriate person can provide a solution.

Why is it Inevitable?

By virtue of the shear number of different WordPress plugins, themes, and PHP versions, there are bound to be interactions that cause issues. Hopefully these issues don’t bring down your site. But some will.

Types of Errors

There are a few basic types of errors common to WordPress sites. Primarily all are PHP errors. There are 3 primary types of PHP errors: PHP Fatal, PHP Warning, and PHP Notice.

Under most circumstances you might not even be aware of either the PHP Warning or PHP Notice errors as they commonly only display in your PHP error log. A PHP Fatal error is the most common cause of the WSOD, but again you won’t see the actual error outside of an error log.

By default WordPress doesn’t display these errors to the user. You can adjust certain settings within wp-config.php to bring these errors to display and/or log them to a WordPress specific debug.log.

For many, modifying the wp-config.php file is a daunting task that in and of itself, can bring your site down. I’ve tried to simplify this with the creation of my WP Debugging plugin.

My plugin will add settings to wp-config.php. More specifically setting WP_DEBUG to true and setting WP_DEBUG_LOG to true. There are a number of additional settings that can also set to assist in debugging.

xDebug Isn’t the Only Way

Tom McFarlin has written extensively about coding and debugging.

In this member’s only post, Tom explains many of the individual settings that can assist in debugging a WordPress site using only native WordPress functions.

Automate All the Things

WP Debugging is a plugin I wrote to automatically add many of WordPress’ built-in settings on plugin activation and remove them on plugin deactivation.

Additionally, the plugin automatically installs and activates 2 additional plugins, Query Monitor by John Billion and Debug Quick Look by Andrew Norcross. These plugins are required, though that can be modified by the user, only because I made that decision.

Query Monitor is an established development plugin that provides a wealth of information for debugging. Debug Quick Look is a wonderful plugin whose sole function is to display the debug.log that WordPress writes debugging errors to when WP_DEBUG_LOG is set to true.

There are also two optional plugin dependencies that request to be installed, Debug Bar and GitHub Updater. The purpose of installing GitHub Updater is to keep the WP Debugging plugin updated.

Looking in the Logs

Viewing the debug.log will allow you to gain insight into the cause of the error. Often these errors will provide a stack trace pointing to exactly the file, function, or line of the error. They will definitely aid the developer.

Debugging is a art. One that you will only gain proficiency in through practice. It is my goal to help bring this information closer to you as simply as possible via the WP Debugging plugin.

You can read more about the specifics of what the WP Debugging plugin does on GitHub and, as always, PRs are happily considered on the develop branch.

Filed under: code, WordPressTagged with: , ,

WordCamp LAX 2015

I’ll have to spiff this up a bit later, but here are my slides from my talk @WordCampLAX 2015.
https://speakerdeck.com/afragen/surgeons-guide-to-plugin-development
And you can watch me on @WordPressTV
http://wordpress.tv/2015/10/08/andy-fragen-surgeons-guide-to-plugin-development/

Filed under: WordPressTagged with: ,

GitHub Updater & GitLab

GitLab Support

I’ve finally been able to add support for GitLab in the GitHub Updater v4.5.0. Additionally, support for GitLab CE and GitLab Enterprise are also included. All that’s required is an additional header with the base URI for the GitLab server. As an example, GitLab CE: https://gitlab.example.com or GitLab Enterprise: https://gitlab.example.com.

Extras for GitHub

Support for GitHub Enterprise is also included using a similar header, GitHub Enterprise: https://github.example.com.
Support for updating from GitHub assets is also included if an asset exists for a tagged release. It will be preferentially used for the update. Using an asset’s URI for the remote installation of a plugin or theme will also function as expected.

Under the Hood

A bit of refactoring has been done as well. An abstract class API has been created to simplify the structure of all the git server API classes. Additionally a class Messages has been created to hold admin notices.
The class Base has been refactored to hold information regarding the added APIs in static arrays for use throughout the codebase.
I hope everyone likes the changes and updates. As always, if there are problems or improvements, please create an issue on GitHub.
Thanks.

Filed under: code, WordPressTagged with: , , , ,

Add Custom Header Images

After using this plugin for quite a while I decided to refactor it and submit it to the WordPress Plugin repo. I figured maybe someone else might find it useful.
What the plugin does is add all images that have been uploaded to a page titled The Headers to the header image array and allows for the selection of any of them or a randomized selection via the Customize > Header Image menu on the front end of the site.
First the plugin removes any of the default header images, if present, and then adds all the images that have been uploaded to The Headers page as the new header images. If you don’t have a page named The Headers then the plugin will not activate. The Headers may be a private page.
The idea for the plugin came from the article written by Julio Biason who was inspired by wpti.ps.

Filed under: code, WordPressTagged with: ,

The Events Calendar Category Colors Plugin

It’s been a wild couple of days figuring this one out. Special thanks to Jonah West for all the help and encouragement. This plugin seeks to greatly simplify the ability to create background colors for your categories in the month view when using The Events Calendar plugin. It requires The Events Calendar v2.0.5 or greater.
TEC Category Colors uses the Tribe Setting API to integrate its settings into TEC’s settings page.
You can grab it from the WordPress Repository.

Filed under: codeTagged with: , ,