- This topic has 14 replies, 2 voices, and was last updated 5 years, 4 months ago by Leo.
-
AuthorPosts
-
December 5, 2018 at 3:25 pm #749179Are Martin
Hi Tom,
I´m using the header element and displaying entry-meta using a shortcode within the page-hero on this page
https://www.fysionett.no/ikke-lenger-nodvendig-med-henvisning-til-fysioterapi/
I´ve disabled the content title. However, as you can see the entry-meta is still displaying so now it´s displayed twice. I´ve tried to find the right combination of css selectors to remove the entry-meta from the entry-header only using
display:none
, but I can´t figure it out. How can I remove this without also removing the entry-meta displaying in the header element?December 5, 2018 at 3:40 pm #749194LeoStaffCustomer SupportHi there,
What shortcode are you using?
Just to make sure, if you hide it using the customizer, both are removed?
https://docs.generatepress.com/article/blog-content-layout/#singleFor CSS, this should work:
.single .entry-header { display: none; }
Let me know if this helps 🙂
December 5, 2018 at 3:48 pm #749198Are MartinThanks, that worked well! 🙂 I´m using this shortcode https://generatepress.com/forums/topic/display-post-meta-in-sections/#post-284619
December 5, 2018 at 3:50 pm #749201LeoStaffCustomer SupportNo problem 🙂
December 5, 2018 at 3:52 pm #749204Are MartinSorry, it did not work that well after all… This css removes the entry-header on all posts. I only want it to be removed on the posts using that particualr shortcode and the header element.
December 5, 2018 at 3:57 pm #749207LeoStaffCustomer SupportSorry have you tried using the template tags? Like using this in page hero content?
{{post_date}} {{post_author}}
December 5, 2018 at 3:59 pm #749208Are MartinI´ve tried them as well but the entry-header is still displaying
December 5, 2018 at 4:08 pm #749217LeoStaffCustomer SupportWeird. I was not able to duplicate that on my install – When I use
{{post_date}} {{post_author}}
as page hero content with the customizer options set to display, then the meta in the content is automatically removed: https://www.screencast.com/t/KYkLDW12ZDCan you try that method again and let me have a look? Thanks!
December 5, 2018 at 4:23 pm #749223Are MartinI´ve used
{{post_date}}
in the header element now. If you use the link above you can check it outDecember 5, 2018 at 5:29 pm #749243LeoStaffCustomer SupportHow are you adding the entry meta in the content?
That’s not the default style.
December 6, 2018 at 12:24 am #749420Are MartinI figured it out
I used this snippet to display all meta in a single line.
/** * CSS also required, see: http://generatepress.com/forums/topic/all-meta-in-one-single-line/#post-108079 */ if ( ! function_exists( 'generate_posted_on' ) ) : /** * Prints HTML with meta information for the current post-date/time and author. */ function generate_posted_on() { if ( 'post' !== get_post_type() ) return; $time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished">%2$s</time>'; if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) $time_string .= '<time class="updated" datetime="%3$s" itemprop="dateModified">%4$s</time>'; $time_string = sprintf( $time_string, esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ), esc_attr( get_the_modified_date( 'c' ) ), esc_html( get_the_modified_date() ) ); printf( __('<span class="posted-on">%1$s</span> <span class="byline">%2$s</span>', 'generate' ), sprintf( '<a href="%1$s" title="%2$s" rel="bookmark">%3$s</a>', esc_url( get_permalink() ), esc_attr( get_the_time() ), $time_string ), sprintf( '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author">%1$s <a class="url fn n" href="%2$s" title="%3$s" rel="author" itemprop="url"><span class="author-name" itemprop="name">%4$s</span></a></span>', __( 'av','generate'), esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_attr( sprintf( __( 'Se flere artikler av %s', 'generate' ), get_the_author() ) ), esc_html( get_the_author() ) ) ); $categories_list = get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'generate' ) ); if ( $categories_list ) { printf( '<span class="cat-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', _x( 'Categories', 'Used before category names.', 'generate' ), $categories_list ); } $tags_list = get_the_tag_list( '', _x( ', ', 'Used between list items, there is a space after the comma.', 'generate' ) ); if ( $tags_list ) { printf( '<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span>', _x( 'Tags', 'Used before tag names.', 'generate' ), $tags_list ); } if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) { echo '<span class="comments-link">'; comments_popup_link( __( 'Leave a comment', 'generate' ), __( '1 Comment', 'generate' ), __( '% Comments', 'generate' ) ); echo '</span>'; } } endif; if ( ! function_exists( 'generate_entry_meta' ) ) : /** * Remove footer entry meta * */ function generate_entry_meta() { return ''; } endif;
I had forgotten about that. When I deactivate the snippet it works like it should 🙂
December 6, 2018 at 12:32 am #749424Are MartinHowever, if I use the shortcode the entry-header doesn´t disappear. (it,s just convenient to use shortcode because it´s already styled)
December 6, 2018 at 8:44 am #749857LeoStaffCustomer SupportNot sure what you mean?
If you want the meta to be removed when they are added in page hero, using template tags is the way to go.
December 7, 2018 at 2:34 am #750418Are MartinI agree 🙂 Thanks for your help!
December 7, 2018 at 8:02 am #750715LeoStaffCustomer SupportNo problem 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.