Site logo

Archived topic

Remove entry header in post

6 replies · Started by Ronny on December 16, 2019

Viewing posts 1–7 of 7

Hi Guy's,

I've created a header element to use for some posts. In the header i've added all post meta like author and date with the template tags. (works great btw!)

But now i would like to remove the entry-header/ entry-meta which is added in the post since this information is already in the header.

Any idea how i can achieve this?

Thanks,
Ronny

Hi there,

when using the Template Tags it should automatically remove entry-header/meta unless you have any functions that change that behaviour.

Can you share a link to the site?

I've added the url in the first post.

I have these filters which maybe can cause this behavior:

//add author image in blog post header
add_filter( 'generate_post_author_output', function() {
return sprintf( ' <span class="byline">%1$s</span>',
sprintf( '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author">%4$s<span class="author-name" itemprop="name">%3$s</span></span>',
esc_url( get_the_author_meta( 'ID' ) ),
esc_attr( sprintf( __( 'View all posts by %s', 'generatepress' ), get_the_author() ) ),
esc_html( get_the_author() ),
get_avatar( get_the_author_meta( 'ID' ) )
)
);
} );
add_filter( 'generate_header_entry_meta_items', function() {
return array('author','date',);
} );
add_filter( 'generate_footer_entry_meta_items', function( $items ) {
return array('date','categories',);
} );
/* remove link in published date */
add_filter( 'generate_post_date_output','tu_remove_date_link', 10, 2 );
function tu_remove_date_link( $output, $time_string ) {
printf( '<span class="posted-on">%s</span>',
$time_string
);
}

Hi there,

Those functions shouldn't prevent the Header Element from removing the default meta.

Can you share the content you've added to your Header Element?

Yeah, sure:

<div class="row">
	<div class="column">
		<div class="hover"><p>Koopgids</p></div>
		<h1>{{post_title}}</h1>
		<p class="underline">Door: Author | Laatste update: {{post_date}}</p>
		<p style="intro">{{custom_field.hero_intro}}</p>
		<a class="button">Lees verder</a>
	</div>
	<div class="column">{{custom_field.featured_image}}</div>
</div>
<div class="scroll-down">
			<svg xmlns="http://www.w3.org/2000/svg" width="21.939" height="24.28" viewBox="0 0 21.939 24.28"><defs><style>.a{fill:#1ca5fc;}</style></defs><g transform="translate(-10.639)"><path class="a" d="M21.608,106.776,32.578,95.807l-3.112-3.112-7.857,7.858-7.857-7.858-3.112,3.112Z" transform="translate(0 -82.496)"/><path class="a" d="M32.578,3.112,29.466,0,21.608,7.858,13.751,0,10.639,3.112,21.608,14.081Z"/></g></svg>
</div> 

Hi Tom,

Found the problem. I didn't use the {{post_author}} field but a fixed text..

Sorry for wasting your time..

Kind regards,
Ronny

Glad you got it working :)

This archived topic is closed to new replies.