In this article, weâll show you 10 useful things you can do with the WordPress loop to make your blog even more powerful than it is right now.
seen from Switzerland
seen from Switzerland

seen from Switzerland
seen from United States

seen from Switzerland

seen from Malaysia

seen from Switzerland

seen from Argentina
seen from Switzerland

seen from Malaysia

seen from Malaysia

seen from United States

seen from Italy
seen from Mexico

seen from United States
seen from China
seen from China

seen from United States
seen from United States

seen from Malaysia
In this article, weâll show you 10 useful things you can do with the WordPress loop to make your blog even more powerful than it is right now.
Wordpress custom loop & the loop
So you wan to use a custom wordpress loop and "the loop" together with no problem?
This is one way to do it, and what i find very easy to use.
For the custom wordpress loop you will have to specify the parameters you want to use.
Eg. $query->query( 'showpost=10&post_type=page&p=32' )
Find the wordpress query parameters here
/* `Custom wordpress loop -----------------------------------------*/ <?php $query = new WP_Query(); $query->query( 'showposts=10' ); while ( $query->have_posts() ) : $query->the_post(); ?> <?php echo the_title(); ?>
<?php echo the_excerpt(); ?> <?php endwhile; ?> /* `The loop -----------------------------------------*/ <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <h2><?php the_title(); ?></h2> <?php the_content(); ?> <?php endwhile; endif; ?>
Суперкод
Для запиту постів у page template з пагінацією
<?php
$temp = $wp_query;
$wp_query= null;
$wp_query = new WP_Query();
$wp_query->query('cat=4&posts_per_page=4'.'&paged='.$paged);
while ($wp_query->have_posts()): $wp_query->the_post(); ?>
<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
<?php endwhile; ?>
<?php get_template_part('navigation'); ?>
<?php $wp_query = null; $wp_query = $temp; ?>