• Resolved yinging

    (@yinging)


    I have to following problem:

    When a click the “Archives” link or any of the Categories links, I can see all relevant posts in my blog, but any pictures or links in them are not displayed.

    In normal mode everything is OK, I can see both the pictures and the links.

    What could be the cause of the problem?

Viewing 8 replies - 1 through 8 (of 8 total)
  • It’s an issue with the theme. If you edit the archive.php template, you’ll find it uses the_excerpt() to display post content, which filters out html tags. So to get what you’re after, you need to change:

    <?php the_excerpt(); ?>

    to

    <?php the_content(); ?>

    Thread Starter yinging

    (@yinging)

    Kafkaesqui, thank you very VERY much!!! :)))

    but is there a way to display only images, and not the text

    but is there a way to display only images, and not the text

    A couple ways to do this are:

    1. Keep the_excerpt() in place and insert the image in the excerpt field of your post as well. This is a bit of a hack, and can cause problems elsewhere (especially if you display summaries in your syndication feeds). But it works; well enough.

    2. Parse the post content for an img tag, and display only this. Something like the following (used in place of the_excerpt() or the_content()) should do:

    <?php
    preg_match('/<img[^>]*>/i', $post->post_content, $image);
    foreach ($image as $display) {
    echo $display . '<br />';
    }
    ?>

    You might even choose to display an excerpt (or post content) if no image is found in a post:

    <?php
    preg_match('/<img[^>]*>/i', $post->post_content, $image);
    if($image) {
    foreach ($image as $display) {
    echo $display . '<br />';
    }
    } else {
    the_excerpt();
    }
    ?>

    nishe

    (@nishe)

    Thank you so much for this! I’ve had the same problem with a theme.

    grmweb

    (@grmweb)

    Thank you Kafkaesqui for the extremely helpful information. ??

    stchatterbox

    (@stchatterbox)

    I’ve the same problem even after changing the <?php the_excerpt();?> to <?php the_content();?>

    I’m using dara’s plugin which shows the flickr slideshow thumbnail using the CUSTOM FIELD when writing the post. I’m creating a “page” for this category and the URL is https://seville.u54.oo.nu/blog/category/fotojournal but then the thumbnail is not showing up. I just wonder how dara made it show up on her archive page at https://www.darasplace.com/category/photography/

    I don’t have her email thus I can’t write her. Please let me know which code shall I put in my archives template. Thanks a lot.

    Had the same problem. Thanks for the fix, Kafkaesqui!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Archive and Categories don’t show pictures and links in posts’ is closed to new replies.