Advertisement
Guest User

functions.php

a guest
Oct 31st, 2016
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.11 KB | None | 0 0
  1. <?php
  2. /**
  3. * Functions - Child theme custom functions
  4. */
  5.  
  6.  
  7. /*****************************************************************************************************************
  8. Caution: do not remove this or you will lose all the customization capabilities created by Divi Children plugin */
  9. require_once('divi-children-engine/divi_children_engine.php');
  10. /****************************************************************************************************************/
  11.  
  12.  
  13. /**
  14. * Patch to fix Divi issue: Duplicated Predefined Layouts.
  15. */
  16. remove_action( 'admin_init', 'et_pb_update_predefined_layouts' );
  17. function Divichild_pb_update_predefined_layouts() {
  18. if ( 'on' === get_theme_mod( 'et_pb_predefined_layouts_updated_2_0' ) ) {
  19. return;
  20. }
  21. if ( ! get_theme_mod( 'et_pb_predefined_layouts_added' ) OR ( 'on' === get_theme_mod( 'et_pb_predefined_layouts_added' ) )) {
  22. et_pb_delete_predefined_layouts();
  23. }
  24. et_pb_add_predefined_layouts();
  25. set_theme_mod( 'et_pb_predefined_layouts_updated_2_0', 'on' );
  26. }
  27. add_action( 'admin_init', 'Divichild_pb_update_predefined_layouts' );
  28.  
  29. function custom_widget_featured_image() {
  30. global $post;
  31.  
  32. echo tribe_event_featured_image( $post->ID, 'thumbnail' );
  33. }
  34. add_action( 'tribe_events_list_widget_before_the_event_title', 'custom_widget_featured_image' );
  35.  
  36. function gallery_size_h($height) {
  37. return '9999';
  38. }
  39. add_filter( 'et_pb_gallery_image_height', 'gallery_size_h' );
  40. function gallery_size_w($width) {
  41. return '9999';
  42. }
  43. add_filter( 'et_pb_gallery_image_width', 'gallery_size_w' );
  44.  
  45. if( class_exists( '\\Fragen\\Category_Colors\\Main' ) ) {
  46.  
  47. teccc_reposition_legend( 'tribe_events_before_footer' );
  48. teccc_add_text_color( 'Red', '#f00' );
  49. teccc_add_legend_view( 'upcoming' );
  50.  
  51. }
  52. add_filter( 'et_builder_post_types', 'rbs_et_builder_post_types' );
  53.  
  54. function rbs_et_builder_post_types ($post_types) {
  55. $custom_post_types = array (
  56. 'tribe_events',
  57. // 'sfwd-courses', - add more CPT's if needed
  58. );
  59.  
  60. $new_post_types = array_merge($post_types, $custom_post_types);
  61. return $new_post_types;
  62. }
  63.  
  64. /* Tribe add category after the title in list views and list widgets */
  65. function tribe_add_category ( ) {
  66.  
  67. $cats = get_the_terms( get_the_ID(), Tribe__Events__Main::TAXONOMY);
  68.  
  69. if ( empty($cats) ) return false;
  70.  
  71. $cat_titles = array();
  72.  
  73. foreach( $cats as $i ) {
  74. $cat_titles[] = $i->name;
  75. }
  76.  
  77. // adjust markup if needed
  78. echo '<p>' . implode(', ', $cat_titles) . '</p>';
  79.  
  80. }
  81.  
  82. // you can also use tribe_events_before_the_event_title
  83. add_action( 'tribe_events_before_the_event_title', 'tribe_add_category' );
  84. // you can also use tribe_events_list_widget_before_the_event_title
  85. add_action( 'tribe_events_list_widget_before_the_event_title', 'tribe_add_category' );
  86.  
  87. /**
  88. * Set the events per page on photo view.
  89. */
  90. function tribe_photo_posts_per_page( $value, $name, $default ){
  91. if ( 'postsPerPage' === $name && tribe_is_photo() ) {
  92. $value = '30';
  93. }
  94. return $value;
  95. }
  96. add_filter( 'tribe_get_option', 'tribe_photo_posts_per_page', 10, 3 );
  97.  
  98. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement