PageRenderTime 123ms CodeModel.GetById 79ms RepoModel.GetById 19ms app.codeStats 0ms

/themes/OneMozilla/sidebar.php

https://github.com/fvignals/One-Mozilla-blog
PHP | 89 lines | 77 code | 10 blank | 2 comment | 30 complexity | 282f91a6d804f5ed672229a4ebf29b74 MD5 | raw file
  1. <div id="content-sub" class="sub sidebar widgets" role="complementary">
  2. <?php if ( !is_active_sidebar('sidebar') ) : ?>
  3. <?php $options = onemozilla_get_theme_options();
  4. /* If we're showing authors, show the bio in the sidebar */
  5. if ( ($options['hide_author'] != 1) && (is_single() || is_author()) ) : ?>
  6. <aside class="widget vcard author-bio">
  7. <h3 class="widget-title">
  8. <?php if (get_the_author_meta('description')) : ?><?php _e('About','onemozilla'); ?><?php endif; ?>
  9. <?php if (get_the_author_meta('user_url')) : ?>
  10. <a class="url fn author" rel="external me" href="<?php the_author_meta('user_url'); ?>"><?php esc_html(the_author()); ?>
  11. <?php if (function_exists('get_avatar')) : echo ('<span class="photo">'.get_avatar( get_the_author_meta('user_email'), 68 ).'</span>'); endif; ?>
  12. </a>
  13. <?php else : ?>
  14. <a class="url fn author" href="<?php echo get_author_posts_url(get_the_author_meta('ID')); ?>"><?php esc_html(the_author()); ?>
  15. <?php if (function_exists('get_avatar')) : echo ('<span class="photo">'.get_avatar( get_the_author_meta('user_email'), 68 ).'</span>'); endif; ?>
  16. </a>
  17. <?php endif; ?>
  18. <?php if (get_the_author_meta('twitter_username')) : ?>
  19. <?php echo '<span><a href="http://twitter.com/'.get_the_author_meta('twitter_username').'" class="url" rel="external me">@'.get_the_author_meta('twitter_username').'</a></span>'; ?>
  20. <?php endif; ?>
  21. </h3>
  22. <?php if (get_the_author_meta('description')) : ?>
  23. <p><?php esc_html(the_author_meta('description')); ?></p>
  24. <?php endif; ?>
  25. <?php if (!is_author()) :
  26. if (get_the_author_meta('first_name')) :
  27. $name = esc_html(get_the_author_meta('first_name')); // Use the first name if there is one
  28. else :
  29. $name = esc_html(the_author()); // Fall back to the display name
  30. endif;
  31. ?>
  32. <p><a class="url go" href="<?php echo get_author_posts_url(get_the_author_meta('ID')); ?>"><?php printf(__('More from %s', 'onemozilla'), $name); ?></a></p>
  33. <?php endif; ?>
  34. </aside>
  35. <?php endif; ?>
  36. <aside id="categories" class="widget widget_categories">
  37. <h3 class="widget-title"><?php _e('Categories', 'onemozilla'); ?></h3>
  38. <ul>
  39. <?php wp_list_categories('show_count=0&title_li='); ?>
  40. </ul>
  41. </aside>
  42. <?php include (TEMPLATEPATH . '/searchform.php'); ?>
  43. <?php else : ?>
  44. <?php $options = onemozilla_get_theme_options();
  45. /* If we're showing authors, show the bio in the sidebar */
  46. if ( ($options['hide_author'] != 1) && (is_single() || is_author()) ) : ?>
  47. <aside class="widget vcard author-bio">
  48. <h3 class="widget-title">
  49. <?php if (get_the_author_meta('description')) : ?><?php _e('About','onemozilla'); ?><?php endif; ?>
  50. <?php if (get_the_author_meta('user_url')) : ?>
  51. <a class="url fn author" rel="external me" href="<?php the_author_meta('user_url'); ?>"><?php esc_html(the_author()); ?>
  52. <?php if (function_exists('get_avatar')) : echo ('<span class="photo">'.get_avatar( get_the_author_meta('user_email'), 68 ).'</span>'); endif; ?>
  53. </a>
  54. <?php else : ?>
  55. <a class="url fn author" href="<?php echo get_author_posts_url(get_the_author_meta('ID')); ?>"><?php esc_html(the_author()); ?>
  56. <?php if (function_exists('get_avatar')) : echo ('<span class="photo">'.get_avatar( get_the_author_meta('user_email'), 68 ).'</span>'); endif; ?>
  57. </a>
  58. <?php endif; ?>
  59. <?php if (get_the_author_meta('twitter_username')) : ?>
  60. <?php echo '<span><a href="http://twitter.com/'.get_the_author_meta('twitter_username').'" class="url" rel="external me">@'.get_the_author_meta('twitter_username').'</a></span>'; ?>
  61. <?php endif; ?>
  62. </h3>
  63. <?php if (get_the_author_meta('description')) : ?>
  64. <p><?php esc_html(the_author_meta('description')); ?></p>
  65. <?php endif; ?>
  66. <?php if (!is_author()) :
  67. if (get_the_author_meta('first_name')) :
  68. $name = esc_html(get_the_author_meta('first_name')); // Use the first name if there is one
  69. else :
  70. $name = esc_html(the_author()); // Fall back to the display name
  71. endif;
  72. ?>
  73. <p><a class="url go" href="<?php echo get_author_posts_url(get_the_author_meta('ID')); ?>"><?php printf(__('More from %s', 'onemozilla'), $name); ?></a></p>
  74. <?php endif; ?>
  75. </aside>
  76. <?php endif; ?>
  77. <?php dynamic_sidebar( 'sidebar' ); ?>
  78. <?php endif; ?>
  79. </div><!-- #content-sub -->