The most basic Lyza Loop usage looks like this:
<?php lyza_loop(); ?>
This will:
Of course, you probably want to do something a bit more clever than that, so you might do:
<?php $args = Array('template' => 'really_cool_stuff', 'showposts' => 4, 'orderby' => 'title', 'category__not_in' => 35, 'exclude_repeats' => false); ?>
In this hypothetical situation:
A loop template is a PHP file with HTML markup, WordPress template tags, and Lyza Loop batching variables that is used to render posts.
Lyza Loop comes with a few default loop templates, but they’re not that great. You’ll probably want to create your own!
Custom loop templates go in the location indicated in the Lyza Loop settings admin panel. By default this is [your theme's directory]/loop_templates. Lyza Loop will automatically see any PHP file in this location and recognize it as a loop template.
Some notes about loop templates:
Lyza Loop provides some convenience batching information that is available in loop templates. The available batching variables are:
$loop_count // Our current item number in the loop $loop_odd // True for odd items in the loop (item 1, 3, 5, etc.) $loop_even // True for even items in the loop (item 2, 4, 6, etc.) $loop_first // True when first item in loop $loop_last // True when last item in loop $loop_css_class // Either 'even' or 'odd' $loop_size // Total number of items in loop $loop_owner // WordPress Post object corresponding to the // global post context when lyza_loop() was called
lyza_loop() takes arguments in standard WordPress argument syntax.
'template': string name of loop template to use, without extension (.php)
example: 'my_template'
'exclude_repeats': Boolean overrides default setting for repeat suppression
example: false (allow duplicates)
'use_template': Boolean render using a template?
example: false (don't render at all, just return matching post objects)lyza_loop() takes any WordPress query_posts() parameter. Please see documentation on query_posts() for more information.