I've created a custom post type in WordPress, and in the single post template, I'm successfully pulling in my custom data using the get_post_custom() function.
But inside The Loop on the list of posts, the function doesn't work and comes back with an empty array.
Here's what I have:
<?php $loop = new WP_Query( array( 'post_type' => 'web-design', 'posts_per_page' => 10 ) ); ?>
<?php $i = 0; ?>
<?php while ( $loop->have_posts() && $i < 3 ) { $loop->the_post(); ?>
<article class="project-link <?php echo 'num' . $i ?>">
<div class="pad">
<?php $project_info = get_post_custom(); ?>
<?php
foreach ($project_info as $i => $values) {
print "$i {\n";
foreach ($values as $key => $value) {
print "$key => $value\n";
}
print "}\n";
}
?>
<?php echo $project_info['url'][0]; ?>
And I don't have anything coming back at all.
Does anyone know why this doesn't work? It works fine in the single post template, why not in the loop?
Thanks!