How to make your WordPress theme Loop Designer ready?

This is an easy tutorial which will show you step-by-step how to make any WordPress theme ready to use the TK Loop Designer for your WordPress loops, for example your archive views.  


Step 1 - Which files to change? 
If you want to use the Loop Designer in your theme's  index.php and  archive.php or  any other WordPress Loop, you need to modify the related template file to make this possible.. 

Step 2 - What to change in these file?
You need to add an extra if-statement around your loop with one function call. That's it.
The if-statement looks like this:
// <em>check if the the loop designer is activated</em>if( function_exists( 'tk_loop_designer_the_loop' ) ) {    tk_loop_designer_the_loop( 'your-loop-template' ); //<em> this function adds the loop designer loop</em><br>} else { // <em>if not activated, continue with the default loop</em>
And don't forget to close it after the loop ends:
}  // <em>closing the if statement </em>
** Maybe you need to set start and end tags for php like this <?php  and this ?> 
Step 3 - Example with Twenty Thirteen WordPress ThemeLet's change the theme's index.php:
<?php get_header();?><p><div id="primary" class="content-area"><div id="content" class="site-content" role="main"></p><p><!-- Here is the added function! --></p><p><?phpif( function_exists( 'tk_loop_designer_the_loop' ) ) {    tk_loop_designer_the_loop( 'your-loop-template' ); <br>} else {?></p><p><!-- This is the Twenty Thirteen default loop: --></p><p>    <?phpif ( have_posts() ) :?><br>        <?php/* The loop */?>        <?phpwhile ( have_posts() ) : the_post();?><br>            <?phpget_template_part('content', get_post_format() );?><br>        <?phpendwhile;?><br>        <?phptwentythirteen_paging_nav();?><br>    <?phpelse :?><br>        <?phpget_template_part('content','none');?><br>    <?phpendif;?></p><p><?php } // Here we close the else case of our if statement ?></p><p></div><!-- #content --><br></div><!-- #primary --></p><p><?phpget_sidebar();?><br><?phpget_footer();?></p>

** Note: Never change theme files directly, create a child theme (or you created your own theme anyway). All you changes would be lost when updating. 

Read more about creating Child Themes here: 

http://codex.wordpress.org/Child_Themes Missing something? 
If you think the description is not clear enough or you need more details for which template files to change, please let us know! 

Still need help? Contact Us Contact Us