• Resolved Matt Blank

    (@mattblank)


    Hi,

    In my footer I use this code:

    <?php
    $posts = get_posts('cat=5&numberposts=3');
    foreach ($posts as $post) : start_wp(); ?>
    <li><a href="<?php the_permalink(); ?>">
    <?php the_post_thumbnail('thumbnail'); ?>
    <?php
    $postid = $wp_query->post->ID;
    echo get_post_meta($postid, 'Short Teaser', true);
    ?></a></li>
    <?php
    endforeach;
    ?>

    Notice after the thumbnail, I’m pulling in a custom field called Short Teaser. This works on every page (though I’ve had previous issues). But on one of my category pages changing:

    <?php if ( have_posts() ) : ?>

    to

    <?php if ( have_posts() ) : query_posts($query_string."&posts_per_page=2&paged=$paged"); ?>

    By doing this, it means on this page it prevents the custom field from showing (thumbnail still displays). Anyone know how I can avoid this? I presume I can pull in the custom field in some other way to stop avoid the clashes I keep getting at every corner.

    Thanks!
    Matt

Viewing 5 replies - 1 through 5 (of 5 total)
  • esmi

    (@esmi)

    Try:

    <?php query_posts($query_string."&posts_per_page=2&paged=$paged");
    if ( have_posts() ) :  ?>
    Thread Starter Matt Blank

    (@mattblank)

    Thanks Esmi, but alas that doesn’t work. It still makes the custom fields disappear.

    I’ve had such issues with the custom field code ?? So many things clash with it.

    esmi

    (@esmi)

    Are you resetting the query after your main Loop & before the secondary Loop?

    Thread Starter Matt Blank

    (@mattblank)

    Perfect!!

    You are my new hero! It’s been bugging me for days ??

    A thousand thanks Esmi.

    Matt
    xx

    esmi

    (@esmi)

    No problem ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Custom Field Isn't Displaying’ is closed to new replies.