web/wp-content/themes/elegant-box/sidebar.php
changeset 1 0d28b7c10758
equal deleted inserted replaced
0:0d9a58d2c515 1:0d28b7c10758
       
     1 <!-- sidebar START -->
       
     2 <div id="sidebar">
       
     3 
       
     4 <!-- Style Switcher START -->
       
     5 <?php
       
     6 	$options = get_option('elegantbox_options');
       
     7 
       
     8 	if($options['style_switcher']) {
       
     9 
       
    10 		// Get the styles folder listing
       
    11 		$styleFolder = TEMPLATEPATH . '/styles/';
       
    12 		$styleArray = array();
       
    13 		$objStyleFolder = dir($styleFolder);
       
    14 		$styleTotal = 0;
       
    15 		while(false !== ($styleFile = $objStyleFolder->read())) {
       
    16 			if(is_dir($styleFolder . $styleFile) && $styleFile != '.' &&  $styleFile != '..') {
       
    17 				$styleArray[] = $styleFile;
       
    18 				$styleTotal += 1;
       
    19 			}
       
    20 		}
       
    21 		$objStyleFolder->close();
       
    22 
       
    23 		// When the styles more than one, display style switcher
       
    24 		if($styleTotal > 1) {
       
    25 ?>
       
    26 <div class="widget">
       
    27 	<div id="styleswitcher">
       
    28 		<span id="style-text"><?php _e('Theme Styles : ', 'elegantbox'); ?></span>
       
    29 <?php
       
    30 			// Display all the style
       
    31 			if (is_array($styleArray)) {
       
    32 				foreach ($styleArray as $style) {
       
    33 ?>
       
    34 			<span id="style-<?php echo($style); ?>" class="color"><a onclick="TSS.setActiveStyleSheet('<?php echo($style); ?>');" href="javascript:void(0);" title="<?php _e('Switch to ', 'elegantbox'); echo($style); ?>"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/transparent.gif" alt="" /></a></span>
       
    35 <?php
       
    36 				}
       
    37 			}
       
    38 ?>
       
    39 		<div class="fixed"></div>
       
    40 	</div>
       
    41 </div>
       
    42 <?php
       
    43 		}
       
    44 	}
       
    45 ?>
       
    46 <!-- Style Switcher END -->
       
    47 
       
    48 		<!-- showcase -->
       
    49 		<?php if( $options['showcase_content'] && (
       
    50 			($options['showcase_registered'] && $user_ID) || 
       
    51 			($options['showcase_commentator'] && !$user_ID && isset($_COOKIE['comment_author_'.COOKIEHASH])) || 
       
    52 			($options['showcase_visitor'] && !$user_ID && !isset($_COOKIE['comment_author_'.COOKIEHASH]))
       
    53 		) ) : ?>
       
    54 			<div class="widget">
       
    55 				<div class="showcase">
       
    56 					<?php echo($options['showcase_content']); ?>
       
    57 				</div>
       
    58 			</div>
       
    59 		<?php endif; ?>
       
    60 
       
    61 		<ul id="widgets">
       
    62 
       
    63 <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
       
    64 
       
    65 			<!-- recent posts -->
       
    66 			<li class="widget widget_pages">
       
    67 				<h3>Recent Posts</h3>
       
    68 				<ul>
       
    69 					<?php $posts = get_posts('numberposts=10&orderby=post_date'); foreach($posts as $post) : setup_postdata($post); ?>
       
    70 						<li>
       
    71 							<span class="sidedate"><?php the_time('y/m/d') ?></span>
       
    72 							<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
       
    73 						</li>
       
    74 					<?php endforeach; $post = $posts[0]; ?>
       
    75 				</ul>
       
    76 			</li>
       
    77 
       
    78 			<!-- recent comments -->
       
    79 			<?php if( function_exists('wp_recentcomments') ) : ?>
       
    80 				<li class="widget">
       
    81 					<h3>Recent Comments</h3>
       
    82 					<ul>
       
    83 						<?php wp_recentcomments('length=14&post=false&avatar_position=left'); ?>
       
    84 					</ul>
       
    85 				</li>
       
    86 			<?php elseif( function_exists('get_recentcomments') ) : ?>
       
    87 				<li class="widget">
       
    88 					<h3>Recent Comments</h3>
       
    89 					<ul>
       
    90 						<?php get_recentcomments('length=14&post=false&avatar_position=left'); ?>
       
    91 					</ul>
       
    92 				</li>
       
    93 			<?php endif; ?>
       
    94 
       
    95 			<!-- tag cloud -->
       
    96 			<li class="widget widget_tag_cloud">
       
    97 				<h3>Tag Cloud</h3>
       
    98 				<?php wp_tag_cloud('smallest=8&largest=16'); ?>
       
    99 			</li>
       
   100 
       
   101 			<!-- categories -->
       
   102 			<li class="widget widget_categories">
       
   103 				<h3>Categories</h3>
       
   104 				<ul>
       
   105 					<?php wp_list_cats('sort_column=name&optioncount=1'); ?>
       
   106 				</ul>
       
   107 			</li>
       
   108 
       
   109 			<!-- archives -->
       
   110 			<li class="widget widget_archive">
       
   111 				<h3>Archives</h3>
       
   112 				<ul>
       
   113 					<?php wp_get_archives('type=monthly'); ?>
       
   114 				</ul>
       
   115 			</li>
       
   116 
       
   117 			<!-- blogroll -->
       
   118 			<li class="widget widget_links">
       
   119 				<h3>Blogroll</h3>
       
   120 				<ul>
       
   121 					<?php if( function_exists( 'wp_multicollinks' ) ) : ?>
       
   122 						<?php wp_multicollinks('orderby=rand&columns=2&limit=20'); ?>
       
   123 					<?php else : ?>
       
   124 						<?php wp_list_bookmarks('title_li=&categorize=0&orderby=rand'); ?>
       
   125 					<?php endif; ?>
       
   126 				</ul>
       
   127 			</li>
       
   128 
       
   129 			<!-- w3c validators -->
       
   130 			<li class="widget">
       
   131 				<h3>W3C validators</h3>
       
   132 				<ul>
       
   133 					<li><a href="http://validator.w3.org/check?uri=referer">XHTML 1.0 Transitional</a></li>
       
   134 					<li><a href="http://jigsaw.w3.org/css-validator/check/referer?profile=css3">CSS level 3</a></li>
       
   135 				</ul>
       
   136 			</li>
       
   137 
       
   138 <?php endif; ?>
       
   139 		</ul>
       
   140 
       
   141 		<!-- showcase 2 -->
       
   142 		<?php if( $options['showcase_2_content'] && (
       
   143 			($options['showcase_2_registered'] && $user_ID) || 
       
   144 			($options['showcase_2_commentator'] && !$user_ID && isset($_COOKIE['comment_author_'.COOKIEHASH])) || 
       
   145 			($options['showcase_2_visitor'] && !$user_ID && !isset($_COOKIE['comment_author_'.COOKIEHASH]))
       
   146 		) ) : ?>
       
   147 			<div class="widget">
       
   148 				<div class="showcase">
       
   149 					<?php echo($options['showcase_2_content']); ?>
       
   150 				</div>
       
   151 			</div>
       
   152 		<?php endif; ?>
       
   153 
       
   154 </div>
       
   155 <!-- sidebar END -->