• Resolved starfix

    (@starfix)


    Hello
    I’ve made a custom template to show all the images loaded in a single post.

    Every image is 100px height and with a relative width (some images are horizontal, some vertical).
    The page works perfectly on safari and firefox.

    In chrome the page works when loaded from the homepage.
    When the single page is reloaded (using the refresh button), the images shrink to fit the title width.
    You can see the issue here:

    the homepage (every square is a single post)
    = = = = = = = = = = = = = = = = = = = = = = =
    https://www.danielabozzetto.com
    = = = = = = = = = = = = = = = = = = = = = = =

    the single post (where the issue is)
    = = = = = = = = = = = = = = = = = = = = = = =
    https://www.danielabozzetto.com/abys/
    = = = = = = = = = = = = = = = = = = = = = = =

Viewing 4 replies - 1 through 4 (of 4 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    The image doesn’t shrink for me when I refresh. It just disappears because I assume it (or something preceding it) is loading first, then reappears.

    I’m using the latest Chrome.

    Thread Starter starfix

    (@starfix)

    maybe i have to recall the loop in some other way?
    Here is my single.php loop:

    ` <div class="five columns">
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <h3 class="series">
    <?php the_title(); ?>
    </h3>
    <?php print_excerpt(5000); ?> </div>
    <?php endwhile; endif; ?>
    <div class="padding20" />
    </div>
    <div class="settimo">
    <ul class="cornice">
    <?php
    $args = array(
    'post_type' => 'attachment',
    'numberposts' => -1,
    'post_status' => null,
    'exclude' => get_post_thumbnail_id( $post->ID ),
    'post_parent' => $post->ID
    );

    $attachments = get_posts( $args );
    if ( $attachments ) {
    foreach ( $attachments as $attachment ) {
    echo '<li>';
    echo the_attachment_link( $attachment->ID, 'thumbnail', false );
    echo '<p class="small-title">';
    echo apply_filters( 'the_title', $attachment->post_title );
    echo '</p></li>';
    }
    }
    wp_reset_postdata(); ?>
    </ul>
    </div>`

    Thread Starter starfix

    (@starfix)

    i’ve tried to solve the problem fo a while but nothing happened.
    If I take off the apply_filters command for displayng the title and write a simple string of characters the problem remain the same:
    ??

    Thread Starter starfix

    (@starfix)

    I solved the issue inserting the images in a div…

    I publish the changed code so it could be useful for someone.

    $attachments = get_posts( $args );
    if ( $attachments ) {
    foreach ( $attachments as $attachment ) {
    echo '
    <li>';
    echo '<div class="imagebox">';
    echo the_attachment_link( $attachment->ID, 'thumbnail', false );
    echo '</div>';
    echo '<p class="small-title">';
    echo apply_filters( 'the_title', $attachment->post_title );
    echo '</p></li>
    ';

    [Moderator note: Please post code between backticks]

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘images distorted with chrome’ is closed to new replies.