Site logo

Archived topic

Display Author meta in Header and problem with elementor

5 replies · Started by Huy on June 16, 2019

Viewing posts 1–6 of 6

Hi guys

I have a problem in displaying author meta in Header Element

I used your code in another topic to create shortcode, I adjusted it a little bit

function tu_custom_author_meta() {
  ob_start();
  global $post;
  $author_id = $post->post_author;
  ?>
	<header class="page-header">
	  <div class="author-meta">
	  	  <h1 class="page-title"><?php echo get_the_author_meta( 'nickname', $author_id ); ?></h1>
	  	<div class="author-photo"> <?php echo get_avatar( $author_id ); ?></div>
	  	<p class="author-description"><?php echo get_the_author_meta( 'description', $author_id ); ?></p>
	  </div>
	</header>
  <?php
  return ob_get_clean();
}
add_shortcode( 'author_meta','tu_custom_author_meta' );

Then I added shortcode [author_meta] in Header Element. It worked, and showed up like this: http://prntscr.com/o2i5wf

However, because I use elementor to design author archive page, when the Header is active, it has an error like this: http://prntscr.com/o2i6e3. it shows only one post per page instead of 6 posts per page.

If I disable the Header, it works like normal: http://prntscr.com/o2i6px.

Could you please show me a way to fix this error, please

Hi there,

that is peculiar - not sure how the header element would effect their post loop query.
But it looks like you're also displaying the same meta data in Elementor - is there a need for the GP header?

Yes I think

Cause in Elementor it's hard for me to customize the layout as I want.

I also want to use Header for all of my archive pages so I really like using Header Element

Is the issue viewable right now? The site looks good to me.

Let me know :)

Yeah I changed totally to use Elementor and disable Page Header so it looks good now

Thank you

Awesome :)

This archived topic is closed to new replies.