Thord Daniel Hedengren - Smashing WordPress_ Beyond the Blog-Wiley (2014)

(avery) #1

100 PART II • Designing and Developing WordPress Themes


// The archives
wp_get_archives( $args );
?>
</ul>
<h2>Browse by category</h2>
<ul>
<?php
// Arguments
$args = array(
'title_li' => ''
);

// The categories
wp_list_categories( $args ); ?>
</ul>
<h2>Browse by tag</h2>
<?php
// Arguments
$args = array(
'smallest' => 8,
'largest' => 28,
'number' => 0,
'orderby' => 'name',
'order' => 'ASC'
);

// The tag cloud
wp_tag_cloud( $args ); ?>
</article>

<?php
// Loop ends
endwhile;
?>

</section> <!-- #main-container ends -->

<?php get_sidebar(); ?>

</div>

<?php get_footer(); ?>

Other common uses are Pages created just to display a specific loop. You can just take your
index.php template file, for example, make a Page template out of it (put the code snippet on
top), and then change the loop to output whatever you want using query_posts(). You
can also have a Page containing multiple loops or perhaps PHP code that isn’t related to
WordPress at all.
Free download pdf