I have created a custom post type that we'll call firemen that I established in functions.php. These post types do not support the classic editor b/c they are intended to be used for individual profiles. Thus, I have enabled 'custom-fields'.
Here's an example of the code I established:
function post_type_firemen() {
register_post_type( 'firemen',
array(
'label' => __('Firemen'),
'public' => true,
'show_ui' => true,
'supports' => array(
'title',
'thumbnail',
'page-attributes',
'post-thumbnails',
'custom-fields')
)
); //end register_post_type
register_taxonomy( 'firemen', 'firemen', array( 'hierarchical' => true, 'label' => __('Firemen') ) );
}
add_action('init', 'post_type_firemen');
I'd like to do something like the following:
<?php
$firemen = new WP_Query('post_type=firemen');
if ($firemen->have_posts():
?>
<ul id="firemen">
<?php while ($firemen->have_posts()): $firemen->the_post(); ?>
<li>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?><?php if ( has_post_thumbnail() ) { the_post_thumbnail(); } ?></a>
</li>
<?php endwhile; ?>
</ul>
<?php endif; ?>
Here's the result I desire:
<ul id="firemen">
<li>
<a href="http://domain.com/bruce-wayne/">Bruce Wayne<img src="http://domain.com/wp-content/themes/theme-name/images/bruce-wayne.png" alt="Bruce Wayne's photo" width="190" height="191" /></a>
</li>
</ul>
I have 10 firemen to display in list items, showing their full thumbnails (heights are the same but widths vary from photo to photo) and a link to the content which is just made up of custom fields information.
I currently can't get the above code to work properly for some reason and it returns a blank ul.
Will the link to "/bruce-wayne/" return the custom fields info or will I need to use a different script to call the custom fields info for each custom post type? I realize that custom-fields need to be called properly in order to display but I'm not sure if I include the_meta() in the href after the permalink or instead.
Thanks for ANY help!!!