[Resolved] How can I re-style the blog page

Home Forums Support [Resolved] How can I re-style the blog page

Home Forums Support How can I re-style the blog page

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #1382130
    Tesco

    I’m using a child theme and I would like to re-style the blog template. Is this possible via Hooks and Filters?

    If so, how?

    #1382163
    Leo
    Staff
    Customer Support

    Hi there,

    What would you like to achieve specifically?

    #1382176
    Tesco

    Hi Leo,

    I’m trying to re-style the blog page by adding two columns (33,66) and adding the featured image on the left and the description on the right.

    Also, make it available the “read more” button just below the description…

    #1382177
    Leo
    Staff
    Customer Support

    Might be able to use CSS for that.

    Something like Marketer?
    http://gpsites.co/marketer/

    #1382180
    Tesco

    Bingo!

    That’s the template I had in mind… How can I achieve that?

    #1382428
    Leo
    Staff
    Customer Support

    So try setting the featured image location to below title:
    https://docs.generatepress.com/article/adjusting-the-featured-images/

    Then resize the image width to something like 300px.

    That should be it ๐Ÿ™‚

    #1385680
    Tesco

    Awesome, thanks!

    #1385972
    Leo
    Staff
    Customer Support

    No problem ๐Ÿ™‚

    #1389282
    Tesco

    Sorry to re-open this but it might be related…

    Is there any way to add a class to the images on the blog page?

    #1389349
    David
    Staff
    Customer Support

    Hi there,

    what specifically do you want to do ? As it may be possible without adding a new class.
    Let me know

    #1389441
    Tesco

    The solution I found was to add a custom style to the classes like so:

    .resize-featured-image .post-image img { my style here }

    And that do the job… but it would be great if I can add a style via some kind of filter OR, maybe you can show me another way (I would be grateful…).

    Thanks, again!

    #1389642
    David
    Staff
    Customer Support

    That is a perfectly good way to do it.
    If you must add a class to the archive featured image you can use this PHP Snippet

    add_filter( 'wp_get_attachment_image_attributes', function( $attr, $attachment ) {
        if ( ! is_single() && $attachment->ID === get_post_thumbnail_id() ) {
            $attr['class'] .= ' your-class';
        }
    
        return $attr;
    }, 10, 2 );
    #1389832
    Tesco

    Awesome, once again!

    Thanks!

    #1390112
    David
    Staff
    Customer Support

    Glad to be of help

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