Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #848

    I bought the Newscast theme for upgrade of

    In my old template I use custom fields for images on the index page, category pages and for some other pages. I have about 1000 posts, that don’t have the featured image set. I think it’s to time consuming to edit all of the posts and that there has to be a simpler way to solve this. I know some php, but obviously not enough to make it alone.

    Would you be so kind and help me to customize your template so, that if there is no featured image set, it uses the image that is set with the custom field “Slika-620×330”.

    This is an example of the code I use now:

    <?php query_posts(‘showposts=1&cat=459’); // cat 459 is for the featured category ?>

    <?php while (have_posts()) : the_post(); ?>

    <?php $slika_620x330 = get_post_meta($post->ID, ‘Slika-620×330’, true); ?>

    ” class=”thumb-mini” alt=”<?php the_title(); ?>” />

    ” title=”Povezava na <?php the_title(); ?>”><?php the_title(); ?>

    <?php echo $povzetek_mini; ?>

    <?php endwhile; ?>


    Try this code

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

    $preview_image = kriesi_post_thumb($post->ID, array('size'=> array('M'),
    'display_link' => array('lightbox'), // '_prev_image_link' or array('lightbox')
    'linkurl' => array ('fullscreen','_preview_big'),
    'wh' => $k_option['custom']['imgSize']['M']

    if ($preview_image == "") {
    $slika_620x330 = ....your code;

    $preview_image = $slika_620x330;


    It works, thanks!

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

The topic ‘If there is no featured image use custom field’ is closed to new replies.