Context: I am building a portfolio index where I can sort the individual project links in my sidebar by priority of appearance. I’ve successfully done this using the wp_nav_menu(), where each project is represented by the text name, and then I can move each Page’s priority of appearance. What I get is something like this:
Projects Menu List:
Now, I’d like to extend this feature by outputting the featured image associated with every individual project page so that it looks something like this:
Project Menu List:
Is this possible with the wp_nav_menu() call? If so, any clues on how to extend it further? Thanks!
Honestly I have not used wp-nav-menu much other than just using it for a menu. I am thinking in your case it might be more semantic to create a custom-post-type for “Projects” and then list those (rather than using the wp-menu as a Project sorter)
. You can use the plugin “Post Types Order” to order your custom posts the way you want (works the same as arranging the order of menus..with a drag and drop).
The advantage to using Custom Post Types is that there is a lot more flexibility to use them how you want.
So, in short:
$example = new WP_Query( 'post_type' => 'projects','showposts' => '20' ); // gives the title for each project if ( $example->have_posts() ) : while ( $example->have_posts() ) : the_post(); ?> <div class="project" > <!-- thumbnail --> <span class="project-thumb"> <?php the_post_thumbnail(); ?> </span> <!-- end thumbnail --> <h4><?php the_title(); ?></h4><!--title --> </div><!--#project --> <?php endwhile; endif;