Created
August 11, 2017 15:29
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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