Skip to content

Need way to retrieve modules by post ID #97

@rwrobe

Description

@rwrobe

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions