[Resolved] Post Featured Image Alignment

Home Forums Support [Resolved] Post Featured Image Alignment

Home Forums Support Post Featured Image Alignment

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #784929
    Scott

    Is there a way for me to have some post with the featured image aligned center and others with the featured image aligned left?

    I have some post that I use a 900×400 image and others that use 250×250. The 250×250 looks a lot better aligned left. While the 900×400 looks great centered.

    All I see in the Customizer is a global setting for all post.

    #784936
    Leo
    Staff
    Customer Support

    Hi there,

    Are you referring to the single posts?

    You’d likely need to write CSS for each of them unless there is some sort of logic as when the pictures are 250×250.

    Can you link me to one of those post and I can provide the example CSS?

    You can edit the original topic and use the private URL field.

    Let me know πŸ™‚

    #784939
    Scott

    Yes single post. The images that are 250×250 are all in the same category. Could I use something like this..

    add_filter( 'generate_blog_image_attributes','tu_variable_image_sizes' );
    function tu_variable_image_sizes( $atts ) {
        // Set up our conditional
        if ( is_post_type_archive( 'store' ) ) {
            $atts[ 'width' ] = 250;
            $atts[ 'height' ] = 250;
            $atts[ 'crop' ] = true;
    	$atts[ 'single_post_image_position' ] = 'below-title';
    	$atts[ 'single_post_image_alignment' ] = 'left';
        }
        // Return our options
        return $atts;
    }
    #784941
    Leo
    Staff
    Customer Support

    Yup that should work πŸ™‚

    #784944
    Scott

    Thanks Leo for the quick response. I found this after I asked the question.

    #784962
    Scott

    Well I thought this was a fix. When I add this code to my child theme functions.php nothing happens. All images are the same as before I added the code.

    #784984
    Leo
    Staff
    Customer Support

    But the function to image size is working?

    Can you link me to the page in question?

    #784989
    Scott

    I made an edit to the first post with my url. This post and all the post in this category I would like the image to float left.

    #785018
    Scott

    Hi Leo, I looked back at some of my previous messages and I probably sounded confusing lol.

    Anyways, I was able to find a simple solution like you mentioned above with css.

    .category-store .featured-image{float:left}

    #785021
    Leo
    Staff
    Customer Support

    Just so I’m clear on this.

    Are the images themselves 250x250px?

    Or you are using this function to make them 250x250px?
    https://generatepress.com/forums/topic/post-featured-image-alignment/#post-784939

    #785023
    Leo
    Staff
    Customer Support

    Ahh ok glad you found a solution πŸ™‚

    #785024
    Scott

    The images themselves are 250×250. So I just needed to add the CSS. I think I made things a lot more complicated than it had to be lol.

    Thanks for your help man.

    #785025
    Leo
    Staff
    Customer Support

    No problem at all πŸ™‚

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