1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/**
 * The Sidebar containing the widget areas.
 */
?>

			<!--BEGIN #secondary-->
            <div id="secondary">

                <?php 	/* Contact Page Widgetized Area */
                    if ( is_page() && get_page_ID_by_page_template('template_contact.php') == $post->ID ) : ?>
                    
                        <?php if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar('Contact Page Sidebar') ) : ?>
                                        
                        <?php endif; ?>
                        
                <?php else : ?>
                
                    <?php 	/* Show current page sub-menu if it's a page and has cildren */				
                            if ( is_page()) : ?>
                                                
                        <?php	/* This Unique Page Widgetized Area */
                            if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar('page_' . $post->ID) ) : ?>
                        
                        <?php endif; ?>
                        
                        <?php	/* Page's Widgetized Area */
                            if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar('Page Sidebar') ) : ?>
                        
                        <?php endif; ?>
                        
                        <?php 	
                            $children = wp_list_pages("title_li=&child_of=".get_root_page($post->ID)."&echo=0"); 
                            if ( $children ) : ?>
                            
                        <!--BEGIN #widget-pages-->
                        <div id="widget-pages" class="widget">
                            <h3 class="widget-title"><?php echo get_page_name_by_ID(get_root_page($post->ID)); ?></h3>
                            <ul>
                                <?php wp_list_pages( 'title_li=&child_of=' . get_root_page($post->ID) ); ?>
                            </ul>
                        <!--END #widget-pages-->
                        </div>
                        
                        <?php endif; ?>
                    <?php else : ?>
                        
                        <?php	/* Blog Widgetized Area */
                            if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar('Blog Sidebar') ) : ?>
                        
                        <?php endif; ?>      
                        
                    <?php endif; ?>
                    
                    
                    <?php	/* Shared (Blog/Page) Widgetized Area */
                    	if ( !function_exists( 'dynamic_sidebar' ) || !dynamic_sidebar('Shared Sidebar') ) : ?>
                        
                    <?php endif; ?>
                    
                <?php endif; ?>	        	
                
            <!--END #secondary-->
            </div>