Advertisement
Guest User

Untitled

a guest
May 2nd, 2012
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.31 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4.  
  5. //
  6.  
  7. // Custom Child Theme Functions
  8.  
  9. //
  10.  
  11.  
  12.  
  13. // More ideas can be found on "A Guide To Customizing The Thematic Theme Framework"
  14.  
  15. // http://themeshaper.com/thematic-for-wordpress/guide-customizing-thematic-theme-framework/
  16.  
  17. // Google and Facebook Meta Tag
  18.  
  19. function google_meta() { ?>
  20.  
  21. <meta name="google-site-verification" content="54yhJE3k6tbVv1DkIVTV5XYeO6aZjfGtvUEkAsoqA7E" /><meta property="fb:page_id" content="173421379405020" /><link rel="SHORTCUT ICON" type='image/x-icon' href="http://cookieandkate.com/images/2011/09/favicon1.ico" /><script type="text/javascript">
  22.  
  23. var _gaq = _gaq || [];
  24. _gaq.push(['_setAccount', 'UA-15904891-2']);
  25. _gaq.push(['_trackPageview']);
  26.  
  27. (function() {
  28. var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  29. ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
  30. var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  31. })();
  32.  
  33. </script>
  34.  
  35. <?php }
  36.  
  37. add_action ('wp_head','google_meta');
  38.  
  39.  
  40. // Viglink code goes before end body tag
  41.  
  42. function viglink_code_beforeendbody() { ?>
  43.  
  44. <script type="text/javascript">
  45. var vglnk = { api_url: '//api.viglink.com/api',
  46. key: '8bc2f7ad8f77d68e7dfac4e570769aae' };
  47.  
  48. (function(d, t) {
  49. var s = d.createElement(t); s.type = 'text/javascript'; s.async = true;
  50. s.src = ('https:' == document.location.protocol ? vglnk.api_url :
  51. '//cdn.viglink.com/api') + '/vglnk.js';
  52. var r = d.getElementsByTagName(t)[0]; r.parentNode.insertBefore(s, r);
  53. }(document, 'script'));
  54. </script>
  55.  
  56. <?php }
  57.  
  58. add_action ('thematic_after', 'viglink_code_beforeendbody');
  59.  
  60. // Remove the standard Thematic menu
  61.  
  62. function remove_menu() {
  63.  
  64. remove_action('thematic_header','thematic_access',9);
  65.  
  66. }
  67.  
  68. add_action('init', 'remove_menu');
  69.  
  70.  
  71. // Moving the thematic menu above the header
  72.  
  73. add_action('thematic_aboveheader','thematic_access');
  74.  
  75.  
  76. function childtheme_override_access() { ?>
  77.  
  78. <div id="access">
  79.  
  80. <div class="skip-link"><a href="#content" title="<?php _e('Skip navigation to the content', 'thematic'); ?>"><?php _e('Skip to content', 'thematic'); ?></a></div><!-- .skip-link -->
  81.  
  82. <?php
  83.  
  84. if ((function_exists("has_nav_menu")) && (has_nav_menu(apply_filters('thematic_primary_menu_id', 'primary-menu')))) {
  85. echo wp_nav_menu(thematic_nav_menu_args());
  86. } else {
  87. echo thematic_add_menuclass(wp_page_menu(thematic_page_menu_args()));
  88. }
  89.  
  90. ?>
  91.  
  92. <div id="access-search">
  93. <form id="searchform" method="get" action="<?php bloginfo('home') ?>">
  94. <div>
  95. <input id="s" name="s" type="text" value="To search, type and hit enter" onfocus="if (this.value == 'To search, type and hit enter') {this.value = '';}" onblur="if (this.value == '') {this.value = 'To search, type and hit enter';}" style="width:300px;" tabindex="1" />
  96. </div>
  97. </form>
  98. </div>
  99.  
  100. </div><!-- #access -->
  101.  
  102. <?php }
  103.  
  104. // Filter away the default scripts loaded with Thematic
  105.  
  106. function childtheme_head_scripts() {
  107.  
  108. // Abscence makes the heart grow fonder
  109.  
  110. }
  111.  
  112. add_filter('thematic_head_scripts','childtheme_head_scripts');
  113.  
  114. function remove_description($display) {
  115.  
  116. $display = FALSE;
  117.  
  118. return $display;
  119.  
  120. }
  121.  
  122. add_filter('thematic_show_description', 'remove_description');
  123.  
  124. //--- Adding Pin it button below posts
  125.  
  126. function webmagic_adding_pinterest($content) {
  127.  
  128. if(is_single()):
  129.  
  130. $content = $content ."<div id=\"pinterest\"><a href=\"javascript:void((function()
  131. {var%20e=document.createElement('script');e.setAttribute
  132. ('type','text/javascript');e.setAttribute('charset','UTF-8');e.setAttribute
  133. ('src',
  134. 'http://assets.pinterest.com/js/pinmarklet.js?r='+Math.random
  135. ()*99999999);document.body.appendChild(e)})());\"><img class=
  136. \"aligncenter\"
  137. src=\"http://www.clickinmoms.com/cmprodaily/
  138. wp-content/uploads/2011/09/pinit.jpg\" alt=\"Pin It\" />
  139. </div>" ;
  140. endif;
  141. return $content;
  142. }
  143. add_filter('the_content', 'webmagic_adding_pinterest',99);
  144.  
  145. // turn off wordpress RSS links, activate Thematic RSS
  146. define('THEMATIC_COMPATIBLE_FEEDLINKS', true);
  147.  
  148. function feedburner_rss(){
  149. return '<link rel="alternate" type="application/rss+xml" href="http://feeds.feedburner.com/CookieAndKate" title="Cookie and Kate Posts RSS feed" />';
  150. }
  151. add_filter('thematic_rss','feedburner_rss');
  152.  
  153. function feedburner_comments_rss(){
  154. return '<link rel="alternate" type="application/rss+xml" href="http://feeds.feedburner.com/CommentsForCookieAndKate" title="Cookie and Kate Comments RSS feed" />';
  155. }
  156. add_filter('thematic_commentsrss','feedburner_comments_rss');
  157.  
  158. add_theme_support('post-thumbnails');
  159. set_post_thumbnail_size(140, 140, true );
  160. add_image_size( 'popular-thumbnail', 140, 140, true );
  161.  
  162. // change post comment text
  163. function postcomment_text(){
  164. $text = "Your comments make my day. Thank you!";
  165. return $text;
  166. }
  167. add_filter('thematic_postcomment_text','postcomment_text');
  168.  
  169. // following two lines are required for Category Thumbnail List plugin
  170.  
  171.  
  172.  
  173. set_post_thumbnail_size( form_option('thumbnail_size_w&&echo=false'),
  174.  
  175.  
  176.  
  177. form_option('thumbnail_size_h&&echo=false'), true );
  178.  
  179.  
  180.  
  181. function my_post_title($title) {
  182.  
  183. if (is_archive() || is_search()) {
  184.  
  185. return '<a class="post-thumbnail-link" href="'.get_permalink().'">'.get_the_post_thumbnail(NULL, 'thumbnail').'</a>' . $title;
  186.  
  187. } else {
  188.  
  189. return $title;
  190.  
  191. }
  192.  
  193. }
  194.  
  195. add_filter('thematic_postheader_posttitle', 'my_post_title');
  196.  
  197.  
  198.  
  199. function my_post_thumbs() {
  200.  
  201. return false;
  202.  
  203. }
  204.  
  205. add_filter('thematic_post_thumbs','my_post_thumbs');
  206.  
  207.  
  208.  
  209. function remove_robots($display) {
  210.  
  211. $display = FALSE;
  212.  
  213. return $display;
  214.  
  215. }
  216.  
  217. add_filter('thematic_show_robots', 'remove_robots');
  218.  
  219. // Puts link in excerpts more tag
  220. function new_home_excerpts($content){
  221. if(is_home()) $content='excerpt';
  222. return $content;
  223. }
  224. add_filter('thematic_content','new_home_excerpts');
  225.  
  226. // Customizes the read more text
  227. function new_excerpt_more($more) {
  228. global $post;
  229. return '<a href="'. get_permalink($post->ID) . '">Continue to the recipe »</a>';
  230. }
  231. add_filter('excerpt_more', 'new_excerpt_more');
  232.  
  233. // Define the excerpt length
  234. function custom_excerpt_length( $length ) {
  235. return 50;
  236. }
  237. add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
  238.  
  239.  
  240. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement