Can this forum help with Wordpress?

Ok…so I’m getting stuck. I know how the custom fields work pretty well now, but I don’t get how I can use documents/attachments with this. It just seems like text entry to me.

How do you see this being used with the docs?

I’d be more descriptive in naming your custom fields, so if I have a PDF, I’d name the custom field “pdf”, the lecture would be named “lecture”, and the word document would be named “document”.

So I could use custom fields for the attachments?

I assume I’d probably need to label the custom field for each class differently so I could pull the files in independent of each other?

So, rock-1-files, rock-2-files, rock-3-files?

Have you contemplated using custom fields for this? Seems like a more fitting approach to what you’re trying to do.

You can then retrieve the information by pulling all custom fields via


<?php $custom_fields = get_post_custom(); ?>

Or you could use a plugin such as this one: http://wordpress.org/extend/plugins/get-custom-field-values/

This is my get_posts() code that gets everything in the whole site.

‘category_name’ => ‘Rock’, is how I tried to filter the files. It got no results. Leaving that out, I get all attachments sitewide. I’ve also tried ‘rock’ which is the slug. It fails to return results.

<?php
$args = array(
'post_type' => 'attachment',
'category_name' => 'Rock',
'numberposts' => -1,
'post_status' => null,
'post_parent' => null
);
$attachments = get_posts($args);
if ($attachments) {
 foreach ($attachments as $post) {
  setup_postdata($post);
  the_title();
  the_attachment_link($post->ID, false);
  the_excerpt();
 }
}
?>

I probably just need to start from scratch, but need guidance.

Just ask the question. :slight_smile:

If it’s mainly a PHP question, certainly, but be aware thet there’s now a dedicated WP Forum too.