Skip to content

Instantly share code, notes, and snippets.

@travisfont
Created August 11, 2017 15:29
Show Gist options
  • Save travisfont/4472a4149f09dc6abd9a57b700848e17 to your computer and use it in GitHub Desktop.
Save travisfont/4472a4149f09dc6abd9a57b700848e17 to your computer and use it in GitHub Desktop.
Work-in-Process: Simple small WordPress Wrapper to make Plugin and Hook programming more object oriented.
namespace WP_Wrapper
{
abstract class Options
{
// wp-includes/option.php
public static function update($option, $value, $autoload = NULL)
{
return update_option($option, $value, $autoload);
}
// wp-includes/option.php
public static function get($option, $default = FALSE)
{
return get_option($option, $default);
}
}
abstract class Post
{
// wp-includes/post.php
public static function get($post = null, $output = OBJECT, $filter = 'raw')
{
return get_post($post, $output, $filter);
}
// wp-includes/post.php
public static function getMeta($post_id, $key = '', $single = FALSE)
{
return get_post_meta($post_id, $key , $single);
}
}
}
namespace WP_Wrapper;
Options::update();
Options::get();
Post::get();
Post::getMeta();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment