Advertisement
novata

2015-08-06 h4bs main child theme

Aug 6th, 2015
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.40 KB | None | 0 0
  1. <?php
  2. /* Write your awesome functions below H4BS-main*/
  3. // === 01 === colophon line space to 2 + 8 + 2
  4. add_filter( 'tc_colophon_left_block_class', 'my_colophon_left_block_class' );
  5. function my_colophon_left_block_class() {
  6. return 'span2 social-block pull-left';
  7. }
  8. add_filter( 'tc_colophon_center_block_class', 'my_colophon_center_block_class' );
  9. function my_colophon_center_block_class() {
  10. return 'span8 credits';
  11. }
  12. add_filter( 'tc_colophon_right_block_class', 'my_colophon_right_block_class' );
  13. function my_colophon_right_block_class() {
  14. return 'span2 backtop';
  15. }
  16. /* === 02 === footer credits*/
  17. add_filter('tc_credits_display', 'my_custom_credits');
  18. function my_custom_credits(){
  19. $newline_credits = '';
  20. $credits = 'All rights reserved. Customiz´d by<a href="http://www.H4BS.com/" target="_blank"> H4 Business Support</a>';
  21. return '
  22. <div class="span8 credits">
  23. <p> &middot; &copy; '.esc_attr( date( 'Y' ) ).' <a href="'.esc_url( home_url() ).'" title="'.esc_attr(get_bloginfo()).'" rel="bookmark">'.esc_attr(get_bloginfo()).'</a> &middot; '.($credits ? $credits : 'Designed by <a href="http://www.themesandco.com/">Themes &amp; Co</a>').' &middot;'.($newline_credits ? '<br />&middot; '.$newline_credits.' &middot;' : '').'</p> </div>';
  24. }
  25. /* === 03 === add widget area between footer widgets and colophon */
  26. add_filter( 'tc_default_widgets' , 'add_footer_colophon_widget' );
  27. function add_footer_colophon_widget( $defaults ) {
  28. $defaults['fc_widgets'] = array(
  29. 'name' => __( 'Footer Colophon Widget' , 'customizr' ),
  30. 'description' => __( 'Widget Area Before Colophon' , 'customizr' )
  31. );
  32. return $defaults;
  33. }
  34. add_action('__footer' , 'display_my_fc_widget', 11 );
  35. function display_my_fc_widget() {
  36. echo '<div class="footer-colophon">';
  37. dynamic_sidebar('fc_widgets');
  38. echo '</div>';
  39. }
  40. /* === 04 === title from grid thumbnail to above excerpts*/
  41. add_action('__post_list_grid', 'my_custom_grid');
  42. function my_custom_grid(){
  43.  
  44. /* title above thumbnails in grid */
  45. add_filter('tc_post_list_layout', 'title_before', 100);
  46. function title_before( $layout){
  47. $layout['show_thumb_first'] = false;
  48. return $layout;
  49. }
  50. }
  51. /* === 05 === Code to select skin type */
  52. add_filter('tc_opt_tc_skin', 'my_skin', 20 );
  53. function my_skin($value){
  54. global $post;
  55. if ( isset($post) && $skin=get_post_meta($post->ID, 'skin', 'true')){
  56. return $skin.'.css';
  57. }
  58. return $value;
  59. }
  60. /* === 07 === webinar featured page title */
  61. add_filter('tc_fp_title' , 'my_custom_fp_titles', 10 ,3);
  62. function my_custom_fp_titles( $original_title , $fp_id = null , $page_id = null ) {
  63.  
  64. //assigns a custom title by page id
  65. $custom_title = array(
  66. //page id => 'Custom title'
  67. 1507 => 'Webinars',
  68. 1675 => 'Webinars pt',
  69. 1673 => 'Webinars en',
  70. );
  71.  
  72. //if no custom title is defined for the current page id, return original
  73. if ( ! isset($custom_title[$page_id]) )
  74. return $original_title;
  75.  
  76. return $custom_title[$page_id];
  77. }
  78. /* === 08 === facebook box */
  79. add_action ('wp_head' , 'add_fb_button_script');
  80. function add_fb_button_script() {
  81. ?>
  82. <div id="fb-root"></div>
  83. <script>(function(d, s, id) {
  84. var js, fjs = d.getElementsByTagName(s)[0];
  85. if (d.getElementById(id)) return;
  86. js = d.createElement(s); js.id = id;
  87. js.src = "//connect.facebook.net/nl_NL/sdk.js#xfbml=1&version=v2.4&appId=832965396796995";
  88. fjs.parentNode.insertBefore(js, fjs);
  89. }(document, 'script', 'facebook-jssdk'));</script>
  90. <?php
  91. }
  92. /* === 09 === marketpress */
  93. add_action('template_redirect', 'handle_marketpress_contents', 100);
  94. function handle_marketpress_contents(){
  95. //do nothing if isn't mp shop page
  96. if ( ! ( function_exists('mp_is_shop_page') && mp_is_shop_page() ) )
  97. return;
  98.  
  99. //display the page content if not displayed by customizr itself
  100. if ( 'page' != tc__f('__post_type') && is_page() ){
  101. add_filter('__post_type', '__return_page');
  102.  
  103. // don't display post and attachment content
  104. remove_action('__loop', array( TC_post::$instance, 'tc_post_content'));
  105. remove_action('__loop', array( TC_attachment::$instance, 'tc_attachment_content'));
  106. }
  107. add_filter('tc_set_grid_hooks', '__return_false');
  108. remove_action ( '__before_loop' , array( TC_headings::$instance , 'tc_render_headings_view' ) );
  109.  
  110. function __return_page(){
  111. return 'page';
  112. }
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement