Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #6208

    How do I make the small preview picture that I have created appear on the posts page?

    For example: http://majormultimediauk.com/stylerevo/?cat=3 I want a tiny image to appear to the left of the posts.

    Thank you! Alex.

    #53326

    Is it possible?

    #53327

    Hey,

    in archive.php replace following code lines:

    if (have_posts()) :
    while (have_posts()) : the_post(); ?>

    with:

    if (have_posts()) :
    while (have_posts()) : the_post();

    // check if we got a previe picture, and which one should be taken
    // (image resizing with "tim thumb" on? then we can take the big one and resize it)
    $preview_small = get_post_meta($post->ID, "_preview_small", true);
    $preview_medium = get_post_meta($post->ID, "_preview_medium", true);
    $preview_big = get_post_meta($post->ID, "_preview_big", true);

    //defaults:
    $preview = $preview_medium;
    $link_url = $preview_big;
    $lightbox = 'singlepost';
    $link = true;
    //change if necessary:

    // resizing? => take next sized picture
    if ($k_option['general']['tim'] == "1" && $preview_medium == "")
    {
    $preview = $preview_big;
    }

    // no bigpicture? => no lightbox
    if ($preview_big == "") { $lightbox = ''; $link = true; $link_url = get_permalink(); }
    // the kriesi_build_image function used here checks if the image should be resized.
    // the function is located in framework/helper_functions

    $preview = kriesi_build_image(array('url'=>$preview,
    'height'=> '273',
    'width'=> '610',
    'lightbox'=>$lightbox,
    'link'=>$link,
    'link_url'=>$link_url
    ));

    ?>

    #53328

    Its still the same :/

    #53329

    Any other advice?

    #53330

    Hey,

    are you certain you’ve cleared your cache after applying Dude’s code? It looks legit, though I haven’t tested it.

    #53331

    Yeah, just tried on my iPhone too, different browsers, different computer and flushed DNS through CMD :(

    #53332

    Tried having a go but I broke the site haha – Don’t know PHP.

    I restored the archive file although here is the code.

    <?php

    global $more, $k_options;

    get_header();?>

    <div id="main">

    <div id="content">

    <h2><?php /* If this is a category archive */ if (is_category()) { ?>

    Archive for <?php echo single_cat_title(); ?>

    <?php /* If this is a daily archive */ } elseif (is_day()) { ?>

    Archive for <?php the_time('F jS, Y'); ?>

    <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>

    Archive for <?php the_time('F, Y'); ?>

    <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>

    Archive for <?php the_time('Y'); ?>

    <?php /* If this is a search */ } elseif (is_search()) { ?>

    Search Results

    <?php /* If this is an author archive */ } elseif (is_author()) { ?>

    Author Archive

    <?php /* If this is a paged archive */ } elseif (isset($_GET) && !empty($_GET)) { ?>

    Blog Archives

    <?php } ?></h2>

    <?php

    if (have_posts()) :

    while (have_posts()) : the_post();

    // check if we got a previe picture, and which one should be taken

    // (image resizing with "tim thumb" on? then we can take the big one and resize it)

    $preview_small = get_post_meta($post->ID, "_preview_small", true);

    $preview_medium = get_post_meta($post->ID, "_preview_medium", true);

    $preview_big = get_post_meta($post->ID, "_preview_big", true);

    //defaults:

    $preview = $preview_medium;

    $link_url = $preview_big;

    $lightbox = 'singlepost';

    $link = true;

    //change if necessary:

    // resizing? => take next sized picture

    if ($k_option == "1" && $preview_medium == "")

    {

    $preview = $preview_big;

    }

    // no bigpicture? => no lightbox

    if ($preview_big == "") { $lightbox = ''; $link = true; $link_url = get_permalink(); }

    // the kriesi_build_image function used here checks if the image should be resized.

    // the function is located in framework/helper_functions

    $preview = kriesi_build_image(array('url'=>$preview,

    'height'=> '273',

    'width'=> '610',

    'lightbox'=>$lightbox,

    'link'=>$link,

    'link_url'=>$link_url

    ));

    ?>

    <div class='entry blogentry'>

    <h3>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>"><?php the_title(); ?></h3>

    <?php

    the_excerpt();

    ?>

    " class="more-link">Read more

    </div><!--end entry-->

    <?php endwhile;

    kriesi_pagination();

    else:

    ?>

    <div class="entry">

    <h2>Nothing Found</h2>

    <p>Sorry, no posts matched your criteria.</p>

    </div>

    <?php

    endif;

    ?>

    </div><!-- end content -->

    <?php get_sidebar(); ?>

    </div><!--end main-->

    <?php get_footer(); ?>

    #53333

    Hey,

    I checked the php syntax and it’s valid. What error message do you get?

    #53334

    Sorry I fixed that by restoring it, just thought you should know at that point in case you was looking at it.

    Do you know why the posts are not showing images next to them still?

    #53335

    Any luck?

    #53336

    Not sure why the mod didn’t work for you – I’ve uploaded my archive.php code here: http://pastebin.com/3cmqYfhR and it works on my test server.

    #53337

    Oh, worked when I did that, wonder what I did wrong!

    Got there in the end haha, thanks so much for the help! :)

    #53338

    Glad to see it worked out after all :)

Viewing 14 posts - 1 through 14 (of 14 total)

The topic ‘Adding an image to the posts page’ is closed to new replies.