[Resolved] Change the Position of MetaData (Comments, Category)

Home Forums Support [Resolved] Change the Position of MetaData (Comments, Category)

Home Forums Support Change the Position of MetaData (Comments, Category)

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #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:

    So far I have achieved this:

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

    #830908
    Leo
    Staff
    Customer Support
    #830934
    Patrick

    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

    #831100
    Leo
    Staff
    Customer Support

    Ok 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>';
        }
    } );
    #832600
    Patrick

    Thanks for the outstanding support, it works! Had to disable everything except the Post Date in the customizer too.

    #833131
    Leo
    Staff
    Customer Support

    No problem ๐Ÿ™‚

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