Closed sharmashivanand closed 6 years ago
The reason for the difference between the two is that hybrid_has_post_layout()
is a template tag and hybrid_get_post_layout()
is a function wrapper for get_post_meta()
.
Honestly, the functions should probably be in separate functions-layouts.php
and template-layouts.php
files to separate these things but I've kept them together just to cut back on extra files.
If I made this change, it'd make sense to make the same change with user and term layout getter functions. It'd also make sense to make this change elsewhere in the framework where it follows the same pattern.
It's something that I'd need to mull over. For my own sanity and keeping things consistent, I'd want to look at how I do this across the board (in themes and plugins).
As far as your custom function is concerned, I wouldn't use hybrid_has_post_layout()
in template_redirect
without explicitly passing in get_queried_object_id()
anyway.
Closing this one simply because layouts have been removed in 5.0.
Currently the function is declared as hybrid_get_post_layout( $post_id ). This does not catch the post_id by default.
Can we define it like:
Eg: the function
hybrid_has_post_layout( $layout, $post_id = '' )
is already following the same norm.Use case:
https://core.trac.wordpress.org/ticket/21256#comment:28