The Loop is a standard feature of all WordPress themes. It is responsible for fetching from the database and outputting content for single Posts and Pages, the front page, archives and search results.
With a Genesis theme, it’s easy to remove the Loop altogether or just reposition it to better suit your design.
The function that is responsible for running the loop is
This function calls up
genesis_legacy_loop (XHTML) or
genesis_custom_loop if the blog page template is in use. These functions then handle the nitty-gritty of the Loop, which is a standard WordPress theme feature.
genesis_do_loop is hooked to
genesis_loop at the default priority 10.
Remove the Loop
Below is the code to remove the loop altogether by unhooking
genesis_loop. You can use the template hierarchy to only remove it under certain circumstances.
Reposition the Loop
To reposition the loop, first unhook
genesis_loop, and then re-hook it on a different hook. Just replace
another_hook with your desired hook.
Replace the Loop
To replace the loop, first unhook
genesis_loop, and then hook your own alternative content.
Genesis Simple Hooks
As an alternative to installing code, the plugin Genesis Simple Hooks allows you to do all of the above. You can find
genesis_loop under Loop Hooks, where there is an option to remove the loop by unhooking
To replace the loop, unhook
genesis_do_loop and enter your replacement content into the box.
To reposition the loop, unhook
genesis_do_loop and then enter it into the box for a different hook. Just make sure to select Execute PHP.
genesis_do_loop has been included since version 1.1.0.
genesis_do_loop is located in lib/structure/loops.php.