- This topic has 6 replies, 3 voices, and was last updated 4 years, 4 months ago by Tom.
-
AuthorPosts
-
December 16, 2019 at 2:27 am #1105561Ronny
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,
RonnyDecember 16, 2019 at 6:21 am #1105726DavidStaffCustomer SupportHi 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?
December 16, 2019 at 7:01 am #1105898RonnyI’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
);
}December 16, 2019 at 5:49 pm #1106322TomLead DeveloperLead DeveloperHi 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?
December 17, 2019 at 12:01 am #1106476RonnyYeah, 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>
December 17, 2019 at 12:14 am #1106484RonnyHi Tom,
Found the problem. I didn’t use the {{post_author}} field but a fixed text..
Sorry for wasting your time..
Kind regards,
RonnyDecember 17, 2019 at 9:15 am #1107037TomLead DeveloperLead DeveloperGlad you got it working 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.