Viewing 2 replies - 1 through 2 (of 2 total)
  • First, we understand that is not a WP site, correct?

    Ok then.

    An easy way to go about this is to use the post ID #s for the images’ names, then in your template where you wish the image to appear add something like:

    <img src="/images/<?php echo $post->ID; ?>.jpg" />

    The path and image filetype is arbitrary and up to you. A tiny bit more complicated slice of code to evaluate if the file exists first:

    <?php
    $image = ABSPATH . 'images/' . $post->ID . '.jpg';
    if(file_exists($image)) :
    ?>
    <img src="/images/<?php echo $post->ID; ?>.jpg" />
    <?php endif; ?>

    You may want to add further refinement to it such as width, height and title attributes and the like. The rest is just CSS…

    Thread Starter smashige

    (@smashige)

    thanks a lot for your anwser, no – the other site https://www.fm4.at is apparently not a wordpress site – but my https://www.smashigcom site is one,.. however, my php skills are not really advanced, and I figured out that I can also write the href in the excerpt and simbsalabim an image appears! however, thanks a lot for your effort – the wordpress support is really awesome, without you guys I would have been lost, but with every anwser I learn more about wordpress… I wanna be one time a wordpress guru :-)))

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘image in excerpt’ is closed to new replies.