Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

mobile image layout

  • https://postimg.cc/ygjKzG3y

    Hello.

    There is a gap between the image and the text, even though the margin is 0.

    And part 2 also has a strange design.

    Is it because I use the php code below to give a padding value of 20 at the bottom of the image? If so, can it not be applied on mobile?

    add_filter( 'generateblocks_defaults', function( $defaults ) {
        $color_settings = wp_parse_args(
            get_option( 'generate_settings', array() ),
            generate_get_color_defaults()
        );
    
        $defaults['image']['marginBottom'] = '20';
    
        return $defaults;
    } );
  • Hi there,

    You can try updating the PHP snippet to this:

    add_filter('generateblocks_defaults', function ( $defaults ) {
    	if ( ! wp_is_mobile() ) {
    		$defaults['image']['marginBottom'] = '20';
    	}
    
    	return $defaults;
    });

    The updated code should only be running on desktop.

  • Thank you so much!

  • You’re welcome.

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