Skip to content
New issue

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

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

Already on GitHub? # to your account

Need way to retrieve modules by post ID #97

Open
rwrobe opened this issue Oct 30, 2018 · 0 comments
Open

Need way to retrieve modules by post ID #97

rwrobe opened this issue Oct 30, 2018 · 0 comments

Comments

@rwrobe
Copy link

rwrobe commented Oct 30, 2018

For the sake of templating and using Hogan in contexts like page_for_posts, we need a way to retrive Hogan modules by ID. Right now, the closest I can get is by making get_current_post_layouts a public method and using something like this:

/**
 * Returns the Hogan modules for a post.
 *
 * @param \WP_Post $post The post object.
 *
 * @return string The content.
 */
function hogan_get_layouts( \WP_Post $_post ): string {
		$hogan            = \Dekode\Hogan\Core::get_instance();
	$flexible_content = '';
	$modules_content  = $hogan->append_modules_content( $post->post_content );

	return $modules_content;
}

The above doesn't work, incidentally, but hopefully illustrates the problem.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

1 participant