getButterfly Logo getButterfly

You have finally decided to update and customize your roo! Framework plugin and you want to create separate templates for your single items and their taxonomy.

First, you need to duplicate your single.php file inside your themes folder – /wp-content/themes/your-theme-name/ – and rename it as single-roo.php. Keep your existing structure, but delete the loop and replace it with:

<?php if(function_exists('roo_single')) roo_single(); ?>

For example, my single-roo.php file looks like this:

<?php get_header(); ?>

<div id="page_wrap">
    <div id="page" class="is_page">
        <?php if(function_exists('roo_single')) roo_single(); ?>
    </div>
</div>

<?php get_sidebar(); ?>
<?php get_footer(); ?>

As you can see, I have the required WordPress header, sidebar and footer functions, but no loop. The roo_single() function includes a custom loop.

In order to have a better archive/category page, you need to duplicate your category.php (or archive.php) file and rename it as taxonomy-roo_category.php. Clean it as above, then add this function inside the loop:

<?php if(function_exists('roo_category')) roo_category(); ?>

Mine looks like this:

<?php get_header();?>

<div id="page_wrap">
    <div id="page" class="is_page">
        <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
            <?php if(function_exists('roo_category')) roo_category(); ?>
        <?php endwhile; endif; ?>
    </div>
</div>

<?php get_sidebar(); ?>
<?php get_footer(); ?>

See how easy it is?

The latest version of the plugin now includes these sample files in the documentation folder.


Subscribe to getButterfly Blog

Once a week or so we send an email with our best content. We never bug you, we just send you our latest piece of content.



If you found any value in this post, agree, disagree, or have anything to add - please do. I use comments as my #1 signal for what to write about. Read our comment policy before commenting! Comments such as "Thank you!", "Awesome!", "You're the man!" are either marked as spam or stripped from URL.

Leave a reply