Support » Plugins » Hacks » retrive category posts using custom field values

  • hello….

    i have three categorys. in that ‘news’ is one of the category. that category posts having custom field key named as ‘ratings’. giving rating values between 0-9.

    i want to display 5 posts in my sidebar of top ratings. how to display. i am new to wordpress. please help me…..


Viewing 1 replies (of 1 total)
  • actually i am displaying like this. but this is displaying last five ratings only.but i want to display top five ratings from category ‘news id=9’ posts.`<ul>

    query_posts($query_string . ‘&cat=9&meta_key=ratings’); ?>

    if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <?php if ( function_exists(‘get_custom_field_value’) ){
    $caticons_ratings=get_custom_field_value(‘ratings’, false);
    //echo $caticons_ratings;
    <li><div class=”list_items_image”><div class=”attach_musicimg”><a href=”<?php echo get_bloginfo(url)?>?artist=<?php the_author(); ?>”><?php the_post_thumbnail(); ?></a></div></div><div class=”list_items_desc”>
    <?php the_title(); ?><p><a href=”<?php echo get_bloginfo(url)?>?artist=<?php urlencode(the_author()); ?>” class=”pink_text”><?php the_author(); ?></a>
    <br /><img src=”<?php bloginfo(‘stylesheet_directory’); ?>/images/star<?php echo $caticons_ratings;?>.gif” /> <?php echo $caticons_ratings.’/10′;?>
    <?php $i++;}}}?>
    <?php endwhile;?>

    <?php endif; ?>

Viewing 1 replies (of 1 total)
  • The topic ‘retrive category posts using custom field values’ is closed to new replies.