I am trying to create a loop that will work as a custom navigation menu in the header using custom post type manager. I am creating a function in the functions.php and then calling the function in the header.php. I can't use the regular " while : have posts etc.." because it actually changes the page content. I just want to create a function that will bring up the image, custom fields, etc..
Here is my code that doesn't work:
<?php
// Our Team Navigation Menu
function our_team_arg( $arg2 ) {
$arg2 = array('posts_per_page' => 60, 'post_type' => 'our_team');
query_posts($arg2);
$myposts = get_posts( $arg2 );
foreach ( $myposts as $post ) : setup_postdata( $post );
?>
<div class="founderblk">
<a href="<?php the_permalink(); ?>">
<img alt="<?php the_title(); ?>" src="<?php print_custom_field('team_member_image:to_image_src'); ?>">
</a><br />
<span class="foundertitle"><?php print_custom_field('team_member_title'); ?></span>
</div>
<?php
endforeach;
wp_reset_postdata();
}
// END Our Team Navigation Menu
?>