WordPress Master Notes

Basically, I’m tired of chasing down my WordPress notes, code snippets, tips, etc.. I’m going to give a public blog post Master Notes page a shot. I figure it might help someone, it’ll keep me interested in adding to and maintaining the content, and it might bring a little exposure to my site.

Develop Themes and Plugins with Debugging On

In your wp-config.php file add:

/**
 * This will log all errors notices and warnings to a file called debug.log in
 * wp-content (if Apache does not have write permission, you may need to create
 * the file first and set the appropriate permissions (i.e. use 666) ) 
 */
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', true );
@ini_set( 'display_errors', 'On' );
 
/**
 * Here is an example that turns php error_logging on and logs them to a specific file. 
 * If WP_DEBUG is defined to true, the errors will also be saved to this file. 
 * Just place this above any require_once or include commands.
*/
@ini_set('log_errors','On');
@ini_set('display_errors','Off');
@ini_set('error_log','/home/example.com/logs/php_error.log');

Reference:

Creating Meta Boxes

I’m currently going with WPAlchemy MetaBox PHP Class by Dimas. A PHP class for WordPress allowing you to easily build WordPress meta boxes. You’ve got yourself a meta-box with the class files, a custom .php file that you configure for your meta box and a  bit of code that looks like this:

$custom_metabox = new WPAlchemy_MetaBox(array
(
	'id' => '_custom_meta',
	'title' => 'My Custom Meta',
	'template' => TEMPLATEPATH . '/custom/my-meta-box-code.php'
));

Post written by Ed Reckers

Founder and lead web development consultant at Red Bridge Internet : San Francisco WordPress Developers and Consultants.

Leave a Reply