Celebrating 7 Years! Get up to $30 off GeneratePress Premium!

[Support request] Changing to different post layout

Home Forums Support [Support request] Changing to different post layout

Home Forums Support Changing to different post layout

  • This topic has 5 replies, 3 voices, and was last updated 3 years ago by Tom.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #562412
    saiprasad

    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 PrasadMy curent layoutReference layout (I want my current layout to look like this)

    GP Premium 1.6.2
    #562551
    Leo
    Staff
    Customer Support

    Hi there,

    Any chance you can disable the maintenance page so we can provide the code?

    Let me know πŸ™‚

    #562555
    saiprasad

    Oh, I am really sorry for that, forgot to disable the maintenance mode
    I have disabled it.

    You can check it now πŸ™‚

    #562871
    Tom
    Lead Developer
    Lead Developer

    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 πŸ™‚

    #562899
    saiprasad

    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 ??

    #563187
    Tom
    Lead Developer
    Lead Developer
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.