WordPress.org

Ready to get started?Download WordPress

Forums

Broken image links showing in Google Chrome (3 posts)

  1. AlexinMilan
    Member
    Posted 5 years ago #

    Hi,

    This is strange. Well, it is for me.

    I downloaded Google Chrome to check out, and visited my blog.

    Looked OK until I got to the bottom right hand column. Here, I've recently tinkered with the code to adjust the order of the items.

    Before:
    Image
    Title
    Snippet

    After:
    Title
    Image
    Snippet

    Looked fine on Firefox, but in Chrome, I can see broken image links.

    See for yourselves: Blog from Italy

    Here is the before and after code:
    Before: Moved code in bold
    <?php
    // enter the IDs of which categories you want to display
    $display_categories = array(34,113,285);
    foreach ($display_categories as $category) { ?>
    <?php query_posts("showposts=4&cat=$category&offset=2");
    $wp_query->is_category = false;
    $wp_query->is_archive = false;
    $wp_query->is_home = true; ?>
    <h2>">
    <?php
    // name of each category gets printed
    single_cat_title(); ?>
    </h2>
    <?php while (have_posts()) : the_post(); ?>
    <?php
    // this grabs the image filename
    $values = get_post_custom_values("rightcolimage");
    // this checks to see if an image file exists
    if (isset($values[0])) {
    ?>

    " rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><img src="<?php bloginfo('url'); echo '/'; echo get_option('upload_path'); echo '/'; $values = get_post_custom_values("rightcolimage"); echo $values[0]; ?>" alt="" />
    <?php } ?>
    <h1>" rel="bookmark">
    <?php
    // this is where title of the article gets printed
    the_title(); ?>
    </h1>

    <?php the_excerpt() ; ?>
    <?php endwhile; ?>

    <?php } ?>

    After: Moved code in bold
    <?php
    // enter the IDs of which categories you want to display
    $display_categories = array(34,113,285);
    foreach ($display_categories as $category) { ?>
    <?php query_posts("showposts=3&cat=$category&offset=1");
    $wp_query->is_category = false;
    $wp_query->is_archive = false;
    $wp_query->is_home = true; ?>
    <h2>">
    <?php
    // name of each category gets printed
    single_cat_title(); ?>
    </h2>
    <?php while (have_posts()) : the_post(); ?>
    <?php
    // this grabs the image filename
    $values = get_post_custom_values("rightcolimage");
    // this checks to see if an image file exists
    if (isset($values[0])) {
    ?>

    <?php } ?>
    <h1>" rel="bookmark">
    <?php
    // this is where title of the article gets printed
    the_title(); ?>
    </h1>

    " rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><img src="<?php bloginfo('url'); echo '/'; echo get_option('upload_path'); echo '/'; $values = get_post_custom_values("rightcolimage"); echo $values[0]; ?>" alt="" />

    <?php the_excerpt() ; ?>
    <?php endwhile; ?>

    <?php } ?>

    My php knowledge is low - aside from understanding what does what, more or less. I'm not sure how flexible the order of the php elements is, and I get parsing errors when I try.

    Can anyone tell me why Google Chrome is showing broken images, but Firefox 3 is not?

    I know Chrome is beta, so this may be part of the reason.

    Thanks for reading,

    Alex

  2. AlexinMilan
    Member
    Posted 5 years ago #

  3. AlexinMilan
    Member
    Posted 5 years ago #

    Sorted this out myself - it was the order of the code.

    After fiddling, I got it.

    Now no more broken image links when the images do not exist.

Topic Closed

This topic has been closed to new replies.

About this Topic