I dug deeper into the core and I’ve been able to address he issue partially (At least in regards of displaying the author tags correctly.
Check out the following core file:
pro/cornerstone/includes/classes/Services/DynamicContent.php
It contains a function called get_contextual_author( $args ) in line 459, which is responsible for fetching the given author based on the available properties.
While this function works great for posts, it does not return the actual author from a given author page.
Maybe this is partially also a naming fault, but generally, if I want to use an archive page template to show the Author page for a single author, I expect to be able to use the dynamic author tags such as {{dc:author:display_name}}
In the latest release, I don’t see any way how you can leverage those dynamic tags for authors on a specific author page.
If I’m using the dynamic user tags, it always returns the current user (which is correct, but not what I need as I need the author).
If I’m using the author tag, nothing is returned instead due to the function mentioned above.
To fix that, I’ve extended the function (for now statically) to represent a check if an author page is given and if it is, fetch the current author from the query vars and load it from the cached users.
The code I added:
if( is_author() ){
$author_id = get_query_var( 'author' );
if( $author_id ){
return $this->get_cached_user( $author_id );
}
}
The full function now:
public function get_contextual_author( $args ) {
if( is_author() ){
$author_id = get_query_var( 'author' );
if( $author_id ){
return $this->get_cached_user( $author_id );
}
}
$post = $this->get_contextual_post( $args );
if ( ! $post ) {
return null;
}
return $this->get_cached_user( get_post_field( 'post_author', $post ) );
}
This gives us back the possibility of using the author tags on single-author pages.
While this is only one part, here are other areas that need to be investigated by your team:
- Why the preview with authors on author pages does not work?
- How does using those tags affect the global author archive page?
- Will the tags for the same way within the loopers?
Would love to see this structure being optimized and implemented.