Create Your Own WordPress Framework From Scratch: Lesson 7 – sidebar.php

In this lesson we will build the sidebar.

This will just be a widgetized sidebar similar to the footer.

Add the following to the sidebar.php file.

<aside class="sidebar" id="sidebar">

    <?php if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar( 'Sidebar' ) ) : ?>

        <section class="sidebar-widget widget">
            <h1 class="widget-title"><?php _e( 'Pages','wft' ); ?></h1>
            <ul>
            <?php wp_list_pages( 'title_li=' ); ?>
            </ul>
        </section>

        <section class="sidebar-widget widget">
            <h1 class="widget-title"><?php _e( 'Category','wft' ); ?></h1>
            <ul>
            <?php wp_list_categories( 'show_count=1&title_li=' ); ?>
            </ul>
        </section>

    <?php endif; ?>
    
</aside>
<!-- /#sidebar -->

Next we will build the single post template.