Archived topic
Changing to different post layout
5 replies · Started by saiprasad on April 28, 2018
Hi,
I want to change my current posts layout to the reference one. I want to align the title to the left, Read More box to the left, Leave a comment to the right, Categories to the top left and author & date to the top left as well. How to do it ?
Please help me regarding this.
For your reference, I have attached both the current and the reference layout.
Regards
Sai Prasad

Hi there,
Any chance you can disable the maintenance page so we can provide the code?
Let me know :)
Oh, I am really sorry for that, forgot to disable the maintenance mode
I have disabled it.
You can check it now :)
Hi there,
1. In "Customize > Additional CSS", find and remove this code:
.entry-header, .entry-meta {
text-align: center;
}
2. Add this CSS:
.entry-header .entry-meta > * {
display: inline-block;
margin-right: 20px;
}
3. Add this PHP:
add_filter( 'generate_post_author_output', 'tu_categories_to_author' );
add_filter( 'generate_category_list_output', '__return_false' );
add_filter( 'generate_tag_list_output', '__return_false' );
add_filter( 'generate_show_comments', '__return_false' );
function tu_categories_to_author( $output ) {
$categories_list = get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'generatepress' ) );
$categories_list = sprintf( '<span class="cat-links"><span class="screen-reader-text">%1$s </span>%2$s</span>',
_x( 'Categories', 'Used before category names.', 'generatepress' ),
$categories_list
);
$tags_list = get_the_tag_list( '', _x( ', ', 'Used between list items, there is a space after the comma.', 'generatepress' ) );
$tags_list = sprintf( '<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span>',
_x( 'Tags', 'Used before tag names.', 'generatepress' ),
$tags_list
);
echo $output . $categories_list . $tags_list;
if ( ! is_single() && ! 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>';
}
}
Hope this helps :)
Thanks a lot Tom for these valuable solutions.
Just one more query, after adding this PHP to the function file, will there be any problem at the time of GP update ??
Not if you use one of the methods here: https://docs.generatepress.com/article/adding-php/