[Resolved] Custom Blog Archive Layout

Home Forums Support [Resolved] Custom Blog Archive Layout

Home Forums Support Custom Blog Archive Layout

  • This topic has 8 replies, 2 voices, and was last updated 5 years ago by Tom.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #868021
    Patrick

    Hi :), I would like to achieve this Layout ->> http://prntscr.com/nbhbeh
    That means:
    – Author + Date Inline above the Title
    – Category inbetween Title and Excerpt
    – Read more + Comments Inline under the Excerpt

    The CSS is no problem but I don’t know how to achieve this with PHP yet.

    #868181
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    First, let’s move the author + date above the title:

    add_action( 'after_setup_theme', function() { 
        remove_action( 'generate_after_entry_title', 'generate_post_meta' );
        add_action( 'generate_before_entry_title', 'generate_post_meta' );
    } );

    Next, we’ll move the categories after the title:

    add_filter( 'generate_show_categories', '__return_false' );
    
    add_action( 'generate_after_entry_title', function() {
        $categories_list = get_the_category_list( ', ' );
    
        if ( $categories_list ) {
            printf( '<span class="cat-links"><span class="screen-reader-text">%1$s </span>%2$s</span>',
                esc_html_x( 'Categories', 'Used before category names.', 'generatepress' ),
                $categories_list
            );
        }
    } );

    Lastly, the comments and read more should be at the bottom by default.

    Let me know πŸ™‚

    #868789
    Patrick

    Thank you so much! Just one more thing:
    Now the Comments are under Read More, is it possible to move them to the same height. So the comments are on the right side?
    Currently the Comments are in the Footer Meta, so moving them into entry-summary I guess?

    I tried it with css and position absolute but I have problems getting it responsive

    #868794
    Patrick

    Ok one more problem. I have now Date and Author above and under the title so twice. I thought I can just deactivate one in the customizer, but it removes both. So how can I keep only the one above the title? πŸ™‚

    #868851
    Tom
    Lead Developer
    Lead Developer

    Any chance you can link me to your site so I can take a look?

    I updated the function above which should fix the second issue.

    Let me know πŸ™‚

    #868857
    Patrick

    Thanks first issue solved.
    Im working local on my site but I made a screenshot for better understanding
    http://prntscr.com/nbxxwh

    #868987
    Tom
    Lead Developer
    Lead Developer

    Hard to know for sure without being able to inspect the code.

    I think absolute positioning is your best bet.

    Something like this:

    .home footer.entry-meta, 
    .archive footer.entry-meta {
        position: absolute;
        bottom: 40px;
        right: 40px;
    }

    Then you can stack them using a media query if it stops working as a specific width:

    @media (max-width: 800px) {
        .home footer.entry-meta, 
        .archive footer.entry-meta {
            position: relative;
            bottom: auto;
            right: auto;
        }
    }
    #869203
    Patrick

    Thanks for all the support, the code helped to figure it out πŸ™‚

    .blog .inside-article{
        position: relative;
    }
    .blog footer.entry-meta {
        position: absolute;
        right: 20px;
        bottom: 60px;
    }
    
    @media (max-width: 800px) {
        .blog footer.entry-meta {
            position: relative;
            bottom: auto;
            right: auto;
        }
    }
    #869671
    Tom
    Lead Developer
    Lead Developer

    Awesome πŸ™‚

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