- This topic has 5 replies, 2 voices, and was last updated 4 years ago by
Leo.
-
AuthorPosts
-
March 6, 2019 at 8:56 am #830715
Patrick
Hi love your Theme so far, I know some basic CSS and minimal PHP. But I need some help here.
I would like to achieve this style for my Blog Posts:
I’m pretty close, but how can I move the category and the comments below the title like on my example?
Happy for any help ๐
GeneratePress 2.2.2GP Premium 1.7.8March 6, 2019 at 11:54 am #830908Leo
StaffCustomer SupportHi there,
Give David’s PHP snippet here a shot:
https://generatepress.com/forums/topic/i-want-my-blog-post-to-look-different-on-mobile/#post-628500Adding PHP: https://docs.generatepress.com/article/adding-php/
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 6, 2019 at 12:31 pm #830934Patrick
Thanks I have added this code as you said
add_action( 'wp', 'tu_move_footer_entry_meta' );
function tu_move_footer_entry_meta() {
if ( is_home() ) {
remove_action( 'generate_after_entry_content', 'generate_footer_meta' );
add_action( 'generate_after_entry_title', 'generate_footer_meta' );
}
}After that I added this CSS so its in one line, no clue if its the best solution
.entry-meta,
.entry-meta .cat-links,
.entry-meta .comments-link{
display:inline;
}Now I only need the category to be at the beginning and I’m happy
March 6, 2019 at 4:29 pm #831100Leo
StaffCustomer SupportOk remove your functions from before and try this instead:
add_filter( 'generate_post_author', '__return_false' ); add_filter( 'generate_post_date_output', function( $output ) { $categories_list = get_the_category_list( ', ' ); if ( $categories_list ) { echo '<span class="cat-links">' . $categories_list . '</span>'; } echo $output; printf( ' <span class="byline">%1$s</span>', // WPCS: XSS ok, sanitization ok. sprintf( '<span class="author vcard" %5$s>%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>', __( 'by', 'generatepress' ), esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), /* translators: 1: Author name */ esc_attr( sprintf( __( 'View all posts by %s', 'generatepress' ), get_the_author() ) ), esc_html( get_the_author() ), generate_get_microdata( 'post-author' ) ) ); if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) { echo '<span class="comments-link">'; comments_popup_link( __( 'Leave a comment', 'generatepress' ), __( '1 Comment', 'generatepress' ), __( '% Comments', 'generatepress' ) ); echo '</span>'; } } );
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/March 8, 2019 at 2:29 am #832600Patrick
Thanks for the outstanding support, it works! Had to disable everything except the Post Date in the customizer too.
March 8, 2019 at 9:47 am #833131Leo
StaffCustomer SupportNo problem ๐
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.