php - wordpress - proper foreach in array syntax -
i'm still novice @ php appreciated. i'm using custom menu display 4 posts, , each post i'd post thumbnail. code below, gives me invalid argument supplied error.
<div id="stampnav"> <?php $pages = wp_nav_menu( array( 'container_class' => 'menu-header','theme_location' => 'stamp-menu' ) ); foreach($pages $pagg) { echo get_the_post_thumbnail($pagg->id, 'thumbnail'); } ?> </div>
you need call global $post , make query post thumbnail menu not return meta associated page, queries built in "menu" custom post type.
your other option create custom walker class nav menu.
Comments
Post a Comment