Advertisement
Guest User

1

a guest
Jan 24th, 2012
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.28 KB | None | 0 0
  1. <?php
  2. // Using hooks is absolutely the smartest, most bulletproof way to implement things like plugins,
  3. // custom design elements, and ads. You can add your hook calls below, and they should take the
  4. // following form:
  5. // add_action('thesis_hook_name', 'function_name');
  6. // The function you name above will run at the location of the specified hook. The example
  7. // hook below demonstrates how you can insert Thesis' default recent posts widget above
  8. // the content in Sidebar 1:
  9. // add_action('thesis_hook_before_sidebar_1', 'thesis_widget_recent_posts');
  10.  
  11. // Delete this line, including the dashes to the left, and add your hooks in its place.
  12.  
  13. /**
  14. * function custom_bookmark_links() - outputs an HTML list of bookmarking links
  15. * NOTE: This only works when called from inside the WordPress loop!
  16. * SECOND NOTE: This is really just a sample function to show you how to use custom functions!
  17. *
  18. * @since 1.0
  19. * @global object $post
  20. */
  21.  
  22.  
  23.  
  24. /*---------- ADD TO ABOVE ----------*/
  25. /*----- Seriously, I wouldn't touch anything past this point if I were you -----*/
  26.  
  27. // Admin
  28. add_action('wp_head', 'extra_css'); // Adds different color options
  29. remove_action('thesis_hook_footer', 'thesis_attribution'); // Remove Thesis Attribution
  30.  
  31. // Header
  32. add_action('wp_head', 'header_image_replace'); // Add's the search bar in Navigation section
  33. add_action('thesis_hook_before_header', 'nav_search'); // Add's the search bar in Navigation section
  34. remove_action('thesis_hook_header', 'thesis_default_header'); // Put Default Header after Second Nav (IE Issues)
  35. add_action('thesis_hook_header', 'second_nav'); // Add's Our Secondary nav section
  36. add_action('thesis_hook_header', 'thesis_default_header'); // Put Default Header after Second Nav (IE Issues)
  37.  
  38.  
  39. // Theme Functions
  40.  
  41. function extra_css() {
  42. global $options; foreach ($options as $value) { if (get_option( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; } else { $$value['id'] = get_option( $value['id'] ); } }
  43.  
  44. switch ($bu_appearance_theme) {
  45. case "Blue (Default)": ?>
  46. <link media="screen, projection" type="text/css" href="<?php bloginfo('template_url'); ?>/custom/css/blue.css" rel="stylesheet" />
  47. <?php break;
  48. case "Green": ?>
  49. <link media="screen, projection" type="text/css" href="<?php bloginfo('template_url'); ?>/custom/css/green.css" rel="stylesheet" />
  50. <?php break;
  51.  
  52. case "Orange": ?>
  53. <link media="screen, projection" type="text/css" href="<?php bloginfo('template_url'); ?>/custom/css/orange.css" rel="stylesheet" />
  54. <?php break;
  55.  
  56. case "Gray": ?>
  57. <link media="screen, projection" type="text/css" href="<?php bloginfo('template_url'); ?>/custom/css/gray.css" rel="stylesheet" />
  58. <?php break;
  59.  
  60. }
  61. }
  62.  
  63. function header_image_replace() {
  64. ?> <link rel="stylesheet" type="text/css" media="all" href="<?php echo get_bloginfo(template_directory);?>/custom/custom_header.css" /> <?php
  65. }
  66.  
  67. function nav_search() { ?>
  68. <div id="search_bar">
  69. <form method="get" class="search_form" action="<?php echo bloginfo('url'); ?>">
  70. <p>
  71. <input class="text_input" type="text" value="Search the blog..." id="stop" name="s" onfocus="if (this.value == 'Search the blog...') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search the blog...';}" />
  72. <input type="submit" id="topsubmit" value="GO" />
  73. </p>
  74. </form>
  75. </div>
  76.  
  77. <?php }
  78. function second_nav() {
  79. global $options; foreach ($options as $value) { if (get_option( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; } else { $$value['id'] = get_option( $value['id'] ); } } ?>
  80. <div id="second_nav">
  81. <ul id="second_nav_menu">
  82.  
  83. <?php if ($bu_second_nav_one_toggle != "true") { ?><li class="second_nav_one"><a href="<?php echo $bu_second_nav_one_link; ?>"><?php echo $bu_second_nav_one_title; ?> <span class="desc"><?php echo $bu_second_nav_one_description; ?></span></a>
  84.  
  85. <?php if ($bu_one_child_one_title != "" or $bu_one_child_two_title != "" or $bu_one_child_three_title != "" or $bu_one_child_four_title != "" or $bu_one_child_five_title != "") { ?>
  86. <ul class="second_nav_one_sub">
  87. <?php if ($bu_one_child_one_title != "") { ?><li><a href="<?php echo $bu_one_child_one_link; ?>"><?php echo $bu_one_child_one_title; ?></a></li><?php } ?>
  88. <?php if ($bu_one_child_two_title != "") { ?><li><a href="<?php echo $bu_one_child_two_link; ?>"><?php echo $bu_one_child_two_title; ?></a></li><?php } ?>
  89. <?php if ($bu_one_child_three_title != "") { ?><li><a href="<?php echo $bu_one_child_three_link; ?>"><?php echo $bu_one_child_three_title; ?></a></li><?php } ?>
  90. <?php if ($bu_one_child_four_title != "") { ?><li><a href="<?php echo $bu_one_child_four_link; ?>"><?php echo $bu_one_child_four_title; ?></a></li><?php } ?>
  91. <?php if ($bu_one_child_five_title != "") { ?><li><a href="<?php echo $bu_one_child_five_link; ?>"><?php echo $bu_one_child_five_title; ?></a></li><?php } ?>
  92. </ul>
  93. <?php } ?>
  94. </li>
  95. <?php } ?>
  96.  
  97.  
  98. <?php if ($bu_second_nav_two_toggle != "true") { ?><li class="second_nav_two"><a href="<?php echo $bu_second_nav_two_link; ?>"><?php echo $bu_second_nav_two_title; ?> <span class="desc"><?php echo $bu_second_nav_two_description; ?></span></a>
  99.  
  100. <?php if ($bu_two_child_one_title != "" or $bu_two_child_two_title != "" or $bu_two_child_three_title != "" or $bu_two_child_four_title != "" or $bu_two_child_five_title != "") { ?>
  101. <ul class="second_nav_one_sub">
  102. <?php if ($bu_two_child_one_title != "") { ?><li><a href="<?php echo $bu_two_child_one_link; ?>"><?php echo $bu_two_child_one_title; ?></a></li><?php } ?>
  103. <?php if ($bu_two_child_two_title != "") { ?><li><a href="<?php echo $bu_two_child_two_link; ?>"><?php echo $bu_two_child_two_title; ?></a></li><?php } ?>
  104. <?php if ($bu_two_child_three_title != "") { ?><li><a href="<?php echo $bu_two_child_three_link; ?>"><?php echo $bu_two_child_three_title; ?></a></li><?php } ?>
  105. <?php if ($bu_two_child_four_title != "") { ?><li><a href="<?php echo $bu_two_child_four_link; ?>"><?php echo $bu_two_child_four_title; ?></a></li><?php } ?>
  106. <?php if ($bu_two_child_five_title != "") { ?><li><a href="<?php echo $bu_two_child_five_link; ?>"><?php echo $bu_two_child_five_title; ?></a></li><?php } ?>
  107. </ul>
  108. <?php } ?>
  109. </li>
  110. <?php } ?>
  111.  
  112. <?php if ($bu_second_nav_three_toggle != "true") { ?><li class="second_nav_three"><a href="<?php echo $bu_second_nav_three_link; ?>"><?php echo $bu_second_nav_three_title; ?> <span class="desc"><?php echo $bu_second_nav_three_description; ?></span></a>
  113.  
  114. <?php if ($bu_three_child_one_title != "" or $bu_three_child_two_title != "" or $bu_three_child_three_title != "" or $bu_three_child_four_title != "" or $bu_three_child_five_title != "") { ?>
  115. <ul class="second_nav_one_sub">
  116. <?php if ($bu_three_child_one_title != "") { ?><li><a href="<?php echo $bu_three_child_one_link; ?>"><?php echo $bu_three_child_one_title; ?></a></li><?php } ?>
  117. <?php if ($bu_three_child_two_title != "") { ?><li><a href="<?php echo $bu_three_child_two_link; ?>"><?php echo $bu_three_child_two_title; ?></a></li><?php } ?>
  118. <?php if ($bu_three_child_three_title != "") { ?><li><a href="<?php echo $bu_three_child_three_link; ?>"><?php echo $bu_three_child_three_title; ?></a></li><?php } ?>
  119. <?php if ($bu_three_child_four_title != "") { ?><li><a href="<?php echo $bu_three_child_four_link; ?>"><?php echo $bu_three_child_four_title; ?></a></li><?php } ?>
  120. <?php if ($bu_three_child_five_title != "") { ?><li><a href="<?php echo $bu_three_child_five_link; ?>"><?php echo $bu_three_child_five_title; ?></a></li><?php } ?>
  121. </ul>
  122. <?php } ?>
  123. </li>
  124. <?php } ?>
  125.  
  126. <?php if ($bu_second_nav_four_toggle != "true") { ?><li class="second_nav_four"><a href="<?php echo $bu_second_nav_four_link; ?>"><?php echo $bu_second_nav_four_title; ?> <span class="desc"><?php echo $bu_second_nav_four_description; ?></span></a>
  127.  
  128. <?php if ($bu_four_child_one_title != "" or $bu_four_child_two_title != "" or $bu_four_child_three_title != "" or $bu_four_child_four_title != "" or $bu_four_child_five_title != "") { ?>
  129. <ul class="second_nav_one_sub">
  130. <?php if ($bu_four_child_one_title != "") { ?><li><a href="<?php echo $bu_four_child_one_link; ?>"><?php echo $bu_four_child_one_title; ?></a></li><?php } ?>
  131. <?php if ($bu_four_child_two_title != "") { ?><li><a href="<?php echo $bu_four_child_two_link; ?>"><?php echo $bu_four_child_two_title; ?></a></li><?php } ?>
  132. <?php if ($bu_four_child_three_title != "") { ?><li><a href="<?php echo $bu_four_child_three_link; ?>"><?php echo $bu_four_child_three_title; ?></a></li><?php } ?>
  133. <?php if ($bu_four_child_four_title != "") { ?><li><a href="<?php echo $bu_four_child_four_link; ?>"><?php echo $bu_four_child_four_title; ?></a></li><?php } ?>
  134. <?php if ($bu_four_child_five_title != "") { ?><li><a href="<?php echo $bu_four_child_five_link; ?>"><?php echo $bu_four_child_five_title; ?></a></li><?php } ?>
  135. </ul>
  136. <?php } ?>
  137. </li>
  138. <?php } ?>
  139.  
  140. </ul>
  141. </div>
  142. <?php }
  143.  
  144.  
  145. // Footer
  146.  
  147. function widgetFooter() { ?>
  148. <div id="foot">
  149. <div class="full_width">
  150. <div class="page">
  151. <div class="col">
  152. <ul class="sidebar_list">
  153. <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Footer 1') ){ ?>
  154. <li class="widget"><h3><?php _e('Footer Widget 1', 'thesis'); ?></h3><p>You can edit the content that appears here by visiting your Widgets panel and modifying the <em>current widgets</em> there.</p></li><?php } ?>
  155. </ul>
  156. </div>
  157.  
  158. <div class="col">
  159. <ul class="sidebar_list">
  160. <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Footer 2') ){ ?>
  161. <li class="widget"><h3><?php _e('Footer Widget 2', 'thesis'); ?></h3><p>You can edit the content that appears here by visiting your Widgets panel and modifying the <em>current widgets</em> there.</p></li><?php } ?>
  162. </ul>
  163. </div>
  164.  
  165. <div class="col">
  166. <ul class="sidebar_list">
  167. <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Footer 3') ){ ?>
  168. <li class="widget"><h3><?php _e('Footer Widget 3', 'thesis'); ?></h3><p>You can edit the content that appears here by visiting your Widgets panel and modifying the <em>current widgets</em> there.</p></li><?php } ?>
  169. </ul>
  170. </div>
  171. <div id="copyright">
  172. <ul class="sidebar_list">
  173. <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Copyright') ){ ?>
  174. <li class="widget"><p>Drag a <em>text box</em> to the <em>Copyright</em> widget in your Widgets panel to display copyright information here.</p></li><?php } ?>
  175. </ul>
  176. </div>
  177. </div>
  178. </div>
  179. </div>
  180. <?php }
  181. add_action('thesis_hook_after_html', 'widgetFooter');
  182. remove_action('thesis_hook_footer', 'thesis_attribution');
  183. remove_action('thesis_hook_footer', 'thesis_admin_link');
  184.  
  185. register_sidebar(array('name'=>'Footer 1', 'before_title'=>'<h3>', 'after_title'=>'</h3>'));
  186. register_sidebar(array('name'=>'Footer 2', 'before_title'=>'<h3>', 'after_title'=>'</h3>'));
  187. register_sidebar(array('name'=>'Footer 3', 'before_title'=>'<h3>', 'after_title'=>'</h3>'));
  188. register_sidebar(array('name'=>'Copyright', 'before_title'=>'<h3>', 'after_title'=>'</h3>'));
  189.  
  190. // Widgets
  191.  
  192. class bu_featured_widget extends WP_Widget {
  193. function bu_featured_widget() {
  194. $widget_ops = array('classname' => 'widget_bu_featured', 'description' => 'Lists the featured article in the header area.' );
  195. $this->WP_Widget('bu_featured_widget', 'Blogussion - Featured Article', $widget_ops);
  196. }
  197.  
  198. function widget($args, $instance) {
  199. extract($args, EXTR_SKIP);
  200.  
  201. echo $before_widget;
  202. global $post;
  203.  
  204. $the_query = new WP_Query(array('category_name'=>'featured','showposts'=>'1'));
  205. while ($the_query->have_posts()) : $the_query->the_post(); $do_not_duplicate = $post->ID;
  206. $image = get_post_meta($post->ID, 'blogussion_featured_image', $single = true);
  207. $num_comments = get_comments_number();?>
  208. <div class="featured_articles">
  209. <a class="image_link" href="<?php echo the_permalink();?>">
  210. <?php if ($image) { ?><img alt="" src="<?php echo $image;?>"> <?php }
  211. else { ?><img alt="" src="<?php echo get_bloginfo(template_directory); ?>/custom/images/default/thumb_default.gif" /> <?php } ?></a>
  212. <h2 class="title_link"><a href="<?php echo the_permalink();?>"><?php echo the_title(); ?></a></h2>
  213. <p class="by_link">by <?php the_author(); ?> &middot; <a href="<?php echo get_permalink() . '#comments" rel="nofollow"' ?>><?php echo $num_comments; ?> <?php if ($num_comments == 1) { echo 'Comment'; } elseif ($num_comments == 0) { echo 'Comments'; } else { echo 'Comments'; } ?></a></p>
  214. </div>
  215. <div class="clearall"></div>
  216. <?php
  217. wp_reset_query(); //This fixes the no sidebars issue MAH Mar 2010
  218. endwhile;
  219. echo $after_widget;
  220. }
  221.  
  222. function update($new_instance, $old_instance) {
  223. $instance = $old_instance;
  224. return $instance;
  225. }
  226.  
  227. function form($instance) { ?>
  228. <p>To feature a post create a category,name it <strong>Featured</strong> and mark any post with the category.</p>
  229. <?php }
  230. }
  231.  
  232. register_widget('bu_featured_widget');
  233.  
  234.  
  235. /* HOME PAGE CUSTOM TEMPLATE */
  236.  
  237. function home_pagecustom() {
  238. /* check to see if homepage. has to happen inside the function */
  239. if (is_page('test-page') || is_page('77')) { ?>
  240. <div id="content">
  241. <div class="post_box">
  242. <div class="headline_area">
  243. <h2>Your Headline</h2>
  244. </div>
  245. ...This is where your content goes...
  246. </div>
  247. </div>
  248.  
  249.  
  250. <?php } }
  251.  
  252. /* Now we tell Thesis to use the home page custom template */
  253.  
  254. remove_action('thesis_hook_custom_template', 'thesis_custom_template_sample');
  255. add_action('thesis_hook_custom_template', 'home_pagecustom');
  256.  
  257.  
  258. class bu_text_widget extends WP_Widget {
  259. function bu_text_widget() {
  260. $widget_ops = array('classname' => 'widget_bu_text', 'description' => 'Input styled text in the header area.' );
  261. $this->WP_Widget('bu_text_widget', 'Blogussion - Featured Text', $widget_ops);
  262. }
  263.  
  264. function widget($args, $instance) {
  265. extract($args, EXTR_SKIP);
  266.  
  267. echo $before_widget;
  268. $title = empty($instance['title']) ? '&nbsp;' : apply_filters('widget_title', $instance['title']);
  269. $entry_content = empty($instance['entry_content']) ? '&nbsp;' : apply_filters('widget_entry_content', $instance['entry_content']);
  270. echo '<div class="widget_box"><div class="featured_default">';
  271. if ( !empty( $title ) ) { echo $before_title . $title . $after_title; };
  272. echo '<p>' . $entry_content . '</p></div></div>';
  273. echo $after_widget;
  274. }
  275.  
  276. function update($new_instance, $old_instance) {
  277. $instance = $old_instance;
  278. $instance['title'] = strip_tags($new_instance['title']);
  279. //$instance['entry_content'] = strip_tags($new_instance['entry_content']);
  280. $instance['entry_content'] = $new_instance['entry_content']; //Fixed to not strip tags MAH Mar 2010
  281.  
  282. return $instance;
  283. }
  284.  
  285. function form($instance) {
  286. $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'entry_content' => '' ) );
  287. $title = strip_tags($instance['title']);
  288. //$entry_content = strip_tags($instance['entry_content']);
  289. $entry_content = $instance['entry_content']; //Fixed to not strip tags MAH Mar 2010
  290. ?>
  291. <p><label for="<?php echo $this->get_field_id('title'); ?>">Title: <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p>
  292. <p><label for="<?php echo $this->get_field_id('entry_content'); ?>">Content: <textarea class="widefat" id="<?php echo $this->get_field_id('entry_content'); ?>" name="<?php echo $this->get_field_name('entry_content'); ?>" type="text" cols="20" rows="16"><?php echo attribute_escape($entry_content); ?></textarea></label></p>
  293. <?php
  294. }
  295. }
  296. register_widget('bu_text_widget');
  297.  
  298. class bu_subscribe_widget extends WP_Widget {
  299. function bu_subscribe_widget() {
  300. $widget_ops = array('classname' => 'widget_bu_subscribe', 'description' => 'Styled RSS, Email Updates, and Twitter subscribe box in header.' );
  301. $this->WP_Widget('bu_subscribe_widget', 'Blogussion - Subscribe Box', $widget_ops);
  302. }
  303.  
  304. function widget($args, $instance) {
  305. extract($args, EXTR_SKIP);
  306.  
  307. echo $before_widget;
  308. $title = empty($instance['title']) ? '&nbsp;' : apply_filters('widget_title', $instance['title']);
  309. $rss_link = empty($instance['rss_link']) ? '&nbsp;' : apply_filters('widget_rss_link', $instance['rss_link']);
  310. $email_link = empty($instance['email_link']) ? '&nbsp;' : apply_filters('widget_email_link', $instance['email_link']);
  311. $twitter_link = empty($instance['twitter_link']) ? '&nbsp;' : apply_filters('widget_twitter_link', $instance['twitter_link']);
  312. echo '<div class="featured_subscribe">';
  313. if ( !empty( $title ) ) { echo $before_title . $title . $after_title; }; ?>
  314.  
  315. <h4>Stay up to date with our content</h4>
  316. <ul class="subscribe_icons">
  317. <li class="rss"><a title="Subscribe to the RSS Feed" href="<?php echo $rss_link; ?>">RSS Feed <span>Easy access</span></a></li>
  318. <li class="email"><a title="Subscribe to the RSS Feed via Email" href="<?php echo $email_link; ?>">Email Updates <span>Sent to your inbox</span></a></li>
  319. <li class="twitter"><a title="Follow us on Twitter" href="http://www.twitter.com/<?php echo $twitter_link; ?>">Twitter <span>Follow us</span></a></li>
  320. </ul>
  321. <?php
  322. echo '</div>';
  323. echo $after_widget;
  324. }
  325.  
  326. function update($new_instance, $old_instance) {
  327. $instance = $old_instance;
  328. $instance['title'] = strip_tags($new_instance['title']);
  329. $instance['rss_link'] = strip_tags($new_instance['rss_link']);
  330. $instance['email_link'] = strip_tags($new_instance['email_link']);
  331. $instance['twitter_link'] = strip_tags($new_instance['twitter_link']);
  332.  
  333.  
  334. return $instance;
  335. }
  336.  
  337. function form($instance) {
  338. $rss_default = get_bloginfo('rss2_url');
  339. $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'rss_link' => $rss_default, 'email_link' => '', 'twitter_link' => '') );
  340. $title = strip_tags($instance['title']);
  341. $rss_link = strip_tags($instance['rss_link']);
  342. $email_link = strip_tags($instance['email_link']);
  343. $twitter_link = strip_tags($instance['twitter_link']);
  344. ?>
  345. <p><label for="<?php echo $this->get_field_id('title'); ?>">Title: <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p>
  346. <p><label for="<?php echo $this->get_field_id('rss_link'); ?>">RSS Feed Link: <input class="widefat" id="<?php echo $this->get_field_id('rss_link'); ?>" name="<?php echo $this->get_field_name('rss_link'); ?>" type="text" value="<?php echo attribute_escape($rss_link); ?>" /></label></p>
  347. <p><label for="<?php echo $this->get_field_id('email_link'); ?>">Email Updates Link: <input class="widefat" id="<?php echo $this->get_field_id('email_link'); ?>" name="<?php echo $this->get_field_name('email_link'); ?>" type="text" value="<?php echo attribute_escape($email_link); ?>" /></label></p>
  348. <p><label for="<?php echo $this->get_field_id('twitter_link'); ?>">Twitter Username: <input class="widefat" id="<?php echo $this->get_field_id('twitter_link'); ?>" name="<?php echo $this->get_field_name('twitter_link'); ?>" type="text" value="<?php echo attribute_escape($twitter_link); ?>" /></label></p>
  349.  
  350. <?php
  351. }
  352. }
  353. register_widget('bu_subscribe_widget');
  354. require_once ('admin/skin_options.php'); // Include Our Admin Page ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement