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

Conversation

Bjoern3003
Copy link

No description provided.

Do set the post to global to use custom shortcodes for example
Update FavoriteListingPresenter.php
Copy link
Contributor

@gfargo gfargo left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Trying to better understand the problem we are solving by setting the global post object here, could you please explain your use case?

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants