Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

generate_after_header hook not allowing author meta

$
0
0

Replies: 0

Hi,

I have added a hook generate_after_header to create a simple banner for blogs on my site, with the meta: post name, post author, featured image as background image, and categories. Every meta is appearing in right place but the author meta is showing nothing.

add_action( 'generate_after_header','add_banner_to_blog' );  
function add_banner_to_blog() { ?> 
<?php $thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' );?>
<div id="post" class="blog-banner-class" style="background-image: url('<?php echo $thumb['0'];?>')">
	<div class="bg-overlay">
		<div class="grid-container">
		  <div class="blog-meta">
			<h1><?php the_title(); ?></h1>
			<?php the_author(); ?>  | <?php the_category(); ?>
		  </div>
	    </div>
	</div>
</div>
   
<?php }

However, the above code works well and shows everything if I change the hook.

Any suggestions are welcomed!


Viewing all articles
Browse latest Browse all 59525

Trending Articles