0

I have a strange situation on my hand.

I want to list my archives based on a custom field (numerical value) but also display something like a cover.

We have specific posts in different categories but with a numeric custom field, that is unique to multiple posts (something like edition number).

For every edition number i have a different number of posts and a cover image. I would like to display them with something like.

The cover (image) - number of posts - and the date of the edition.

I am able to query by custom value, but i am unable to get the date for them..

I'm not sure how i should approach this and therefore i'm asking here.

LATER EDIT:

What i'm trying to achieve is basically this:

  1. Get a list of all unique meta_values for specific meta_key.
  2. For each meta_value output the cover for it (this will be done based on the key)
  3. For each meta_value list number of posts with a link to see them all (this will be also done based on the meta_value with something like ?meta_key=222.
  4. Paginate so that the page won't get too big as i currently have ~600 unique keys..
1
  • Could you provide a couple of specific examples? and what have you tried so far. Commented Aug 19, 2013 at 13:04

1 Answer 1

0

This will get the posts filtered by custom field and its value based on categories.

$args = array( 'post_type'=>'post',

            'category__in'=> array(6, 7, 31), //category id

            'meta_key'=>'keys', // customfield name
                'meta_value'=>5, // customfield value
                    'posts_per_page'=>-1,
                        'number_posts'=>-1 );

$s = get_posts($args);

foreach($s as $e ) {

echo $e->ID.'<br/>';

echo $e->post_title.'<br/>';

}

1
  • Than you balamurugan and @Srikanth AD, but have a look at my clarification.
    – Ma͢dalin
    Commented Aug 20, 2013 at 10:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.