LOOP WP_Query

<?php // przykladowe wykorzystanie petli $loop = new WP_Query(array( // petla z zawezonym wyszukiwaniem 'post_type' => 'recipes', 'tax_query' => array( array( 'taxonomy' => 'ingredients', 'field' => 'slug', 'terms' => $ingredients ) ) )); if($loop -> have_posts()) : while($loop -> have_posts()) : $loop -> the_post(); ?> <section id=recipe-"<?php the_ID(); ?>" <?php post_class('entry'); ?>> <!-- ID / class='entry' --> <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a> <!-- link / miniaturka --> <h2><a href="<?php the_permalink(); ?>"><?php echo the_title() ?></a></h2> <!-- link / tytul --> <div> <span><?php echo printPreparationTime($post->ID); ?></span> <!-- ID za pomoca obiektu $post --> <ul class="difficulty dark"> <?php printRanking($post->ID); ?> </ul> </div> <p><?php the_excerpt_max_charlength(94);?></p> <a class="more" href="<?php the_permalink(); ?>">...</a> </section> <?php endwhile; ?> <?php else: ?> <h4>Brak postow</h4> <?php endif; ?>

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.