Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do set the post to global to use custom shortcodes for example #99

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion app/Entities/FavoriteList/FavoriteListingPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ private function listingClosing()
*/
private function filterMarkup()
{
global $post;
$post = get_post( $this->favorite, OBJECT );
setup_postdata( $post );

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its important that we reset the global post data to what it was previously after hijacking the $post variable as this could have adverse side effects. I'd imagine using wp_reset_postdata would do the trick.

Codex

$this->html .= apply_filters('the_content', $this->markup);
$this->replacePostFields();
$this->replaceFavoritesFields();
Expand Down Expand Up @@ -166,4 +170,4 @@ private function getPostExcerpt()
return $the_excerpt;
}

}
}