I'd like to display and style the author name in a custom position in the header of a single blog post page (near where the post title is rendered).
I know how to do the styling CSS, and it looks like I can pull the author nickname using get_the_author_meta(). But in which theme file do I place the PHP -- what file is generating the display of the post's title, date, categories (etc.)? I've grepped all around throughout the Kalium hierarchy and can't figure it out.
I understand what do you mean, in our theme you can put your own text on any position of blog post (single page or loop page), and so if you want to add the author meta under the title (above the post content), add this code in functions.php:
gave a satisfactory result, so thank you. I can't figure out *why* this works (specifically: why it places the content in precisely that location), even after looking at blog-template-hooks.php. But I have the result I needed, so I just won't think about it. :)
So to understand how that is added in that particular place is the priority 11 which is located between title and content.
The same template architecture is applied on WooCommerce so we have adopted this technique to simplify custom development without touching the template files.
Hi,
I'd like to display and style the author name in a custom position in the header of a single blog post page (near where the post title is rendered).
I know how to do the styling CSS, and it looks like I can pull the author nickname using get_the_author_meta(). But in which theme file do I place the PHP -- what file is generating the display of the post's title, date, categories (etc.)? I've grepped all around throughout the Kalium hierarchy and can't figure it out.
Hi richmintz,
I understand what do you mean, in our theme you can put your own text on any position of blog post (single page or loop page), and so if you want to add the author meta under the title (above the post content), add this code in functions.php:
There you can put anything you want and it will appear between title and content:
(view large image)
I hope this will help you.
I’ll experiment with this, thank you.
Okay. Adding this
add_action( 'kalium_blog_single_post_details', function() {
echo '<div class="author-meta-custom">';
the_author_meta('display_name');
echo '</div>';
});
gave a satisfactory result, so thank you. I can't figure out *why* this works (specifically: why it places the content in precisely that location), even after looking at blog-template-hooks.php. But I have the result I needed, so I just won't think about it. :)
Hi richmintz,
I am glad to hear that it worked for you, and also I don't mind to explain it further to you why that comes like that:
In kalium/templates/blog/single.php we have a "hook gate" where we assign content based on priorities.
(view large image)
As you can see, hooks are documented which one is added and their priority, basically they are contained in:
inc/functions/template/blog-template-functions.php and assigned in inc/hooks/blog-template-hooks.php:
(view large image)
So to understand how that is added in that particular place is the priority 11 which is located between title and content.
The same template architecture is applied on WooCommerce so we have adopted this technique to simplify custom development without touching the template files.
I hope this helps you.