Skip to content

Commit

Permalink
Adding new setAsGlobal function
Browse files Browse the repository at this point in the history
  • Loading branch information
rasmuswinter committed Feb 9, 2018
1 parent 75c9bbd commit 296be4f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "A plugin for WordPress that makes post types easier to manage",
"minimum-stability": "stable",
"license": "GPL-3.0",
"version": "2.2.3",
"version": "2.2.4",
"autoload": {
"psr-4": {
"Outlandish\\Wordpress\\Oowp\\": "src/"
Expand Down
12 changes: 11 additions & 1 deletion src/PostTypes/WordpressPost.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,20 @@ public static function onRegistrationComplete()
/**
* Return the underlying WP_Post
*/
public function get_post() {
public function get_post()
{
return $this->post;
}

/**
* Sets the underlying WP_Post as the global post
*/
public function setAsGlobal()
{
global $post;
$post = $this->get_post();
}

/**
* Override this to hook into the save event. This is called with low priority so
* all fields should be already saved
Expand Down

0 comments on commit 296be4f

Please sign in to comment.