• Resolved Anonymous User 14978628

    (@anonymized-14978628)


    Hi, I have the images in a block layout, but the images don’t center when the screen width changes.

    Please tell me how i can make the images to always center? Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi,
    Sorry for the late reply. If you have already figured out the solution then its great otherwise follow these steps.

    You can use our filter for this purpose.
    Add the following snippet in the bottom of your theme’s functions.php file

    function rpt_content_align_callback( $class ) {
    $class = “relpost-align-center”;
    return $class;
    }
    add_filter( ‘rpt_content_align’, ‘rpt_content_align_callback’ );

    There are two more options you can provide in $class:
    “relpost-align-right”
    “relpost-align-left”

    You only need to provide each option at a time.

    If this doesn’t work, then share with us you site url we will look into it.

    Thankyou

    Hello,
    I have the same problem. In the Divi text module all settings are set on centering the related posts (in module design text settings and in the text itself: <p style=”text-align: center;”>[related-posts-thumbnails]</p> ), but it does not work. See https://praesenz-web.de/vom-ausbrennen-und-entfachen/

    Inserting the code from above into the functions.php produced a frontend error message:
    “Warning: Use of undefined constant ‘rpt_content_align’ – assumed ‘‘rpt_content_align’’ (this will throw an Error in a future version of PHP) in /www/htdocs/w018af01/praesenz-web.de/wp-content/themes/Divi-Child/functions.php on line 14

    Warning: Use of undefined constant ‘rpt_content_align_callback’ – assumed ‘‘rpt_content_align_callback’’ (this will throw an Error in a future version of PHP) in /www/htdocs/w018af01/praesenz-web.de/wp-content/themes/Divi-Child/functions.php on line 14”
    I am not a code specialist, sorry, and need help to center the images.
    Thank you very much.

    • This reply was modified 5 years, 7 months ago by wpprup.
    • This reply was modified 5 years, 7 months ago by wpprup.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to Center Images’ is closed to new replies.