Displaying content of last recipe only on frontpage
-
I made a template to show the four latest recipes on my frontpage. But I seem to be doing something wrong. I use the image (wprm), the titel of the post (wp) and the summary (wprm).
While it shows the titels correctly for each post, it shows the image and summary of the last post on all posts. So I seem to be doing something wrong. The site is running on localhost, so I can’t send a link, but this is the code I’m using:<div class="fp-recipes-container"> <div class="fp-recipes-container-titel"> MEEST RECENT: BAKKEN - ZOET </div> <div class="fp-spacer-hori-in-container"> </div> <?php $myCatQuery = new WP_Query ( 'category_name=bakkenzoet&posts_per_page=4' ); if ( $myCatQuery->have_posts() ){ while ( $myCatQuery->have_posts() ){ echo '<div class="fp-recipes-blok">'; $myCatQuery->the_post(); echo '<div class="fp-recipes-blok_recipe-image">'; echo do_shortcode( '[wprm-recipe-image]' ); echo '</div>'; echo '<div class="fp-recipes-blok_recipe-titel">'; ?><a href="<?php the_permalink(); ?>"><?php the_title() ?></a> <?php ; echo '</div>'; echo '<div class="fp-spacer-hori-in-blok"></div>'; echo '<div class="fp-recipes-blok_recipe-summary">'; echo do_shortcode( '[wprm-recipe-summary]' ); echo '</div>'; echo '</div>'; } wp_reset_postdata(); } else { echo '<div class="fp-no-post-center">'; echo 'Sorry, (nog) geen posts gevonden voor deze categorie.'; echo '</div>'; } ?> </div>
I hope you can give me an idea where I go wrong here.
Bert.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Displaying content of last recipe only on frontpage’ is closed to new replies.