WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Retriving all posts from category with custom field value (2 posts)

  1. M Szatkowski
    Member
    Posted 4 years ago #

    Hi
    I'm trying to get in index.php all the posts from category id=8 like:

    [post1 title][customfieldvalue=tn_pic]
    [post2 title][customfieldvalue=tn_pic]
    [post3 title][customfieldvalue=tn_pic]
    etc.

    any ideas?

    Thank you

    M

  2. M Szatkowski
    Member
    Posted 4 years ago #

    <div style="background:red;"><h2>
    
    <?php query_posts('showposts=10&cat=33'); ?>
    <?php while (have_posts()) : the_post(); ?>
    <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
    <img src="<?php echo get_option('home'); ?><?php
    // this is where the Lead Story image gets printed
    $values = get_post_custom_values("pic_tn"); echo $values[0]; ?>" alt="" id="leadpic" /></a>
    <h3>
    <?php
    // this is where the name of the Lead Story category gets printed
    single_cat_title(); ?>
    </h3>
    <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>" class="title">
    <?php the_title(); ?>
    </a>
    <?php the_excerpt(); ?>
    {<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">More&raquo;</a>}
    <?php endwhile; ?>
    
    </h2></div>

Topic Closed

This topic has been closed to new replies.

About this Topic