Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Functions - Child theme custom functions
- */
- /*****************************************************************************************************************
- Caution: do not remove this or you will lose all the customization capabilities created by Divi Children plugin */
- require_once('divi-children-engine/divi_children_engine.php');
- /****************************************************************************************************************/
- /**
- * Patch to fix Divi issue: Duplicated Predefined Layouts.
- */
- remove_action( 'admin_init', 'et_pb_update_predefined_layouts' );
- function Divichild_pb_update_predefined_layouts() {
- if ( 'on' === get_theme_mod( 'et_pb_predefined_layouts_updated_2_0' ) ) {
- return;
- }
- if ( ! get_theme_mod( 'et_pb_predefined_layouts_added' ) OR ( 'on' === get_theme_mod( 'et_pb_predefined_layouts_added' ) )) {
- et_pb_delete_predefined_layouts();
- }
- et_pb_add_predefined_layouts();
- set_theme_mod( 'et_pb_predefined_layouts_updated_2_0', 'on' );
- }
- add_action( 'admin_init', 'Divichild_pb_update_predefined_layouts' );
- function custom_widget_featured_image() {
- global $post;
- echo tribe_event_featured_image( $post->ID, 'thumbnail' );
- }
- add_action( 'tribe_events_list_widget_before_the_event_title', 'custom_widget_featured_image' );
- function gallery_size_h($height) {
- return '9999';
- }
- add_filter( 'et_pb_gallery_image_height', 'gallery_size_h' );
- function gallery_size_w($width) {
- return '9999';
- }
- add_filter( 'et_pb_gallery_image_width', 'gallery_size_w' );
- if( class_exists( '\\Fragen\\Category_Colors\\Main' ) ) {
- teccc_reposition_legend( 'tribe_events_before_footer' );
- teccc_add_text_color( 'Red', '#f00' );
- teccc_add_legend_view( 'upcoming' );
- }
- add_filter( 'et_builder_post_types', 'rbs_et_builder_post_types' );
- function rbs_et_builder_post_types ($post_types) {
- $custom_post_types = array (
- 'tribe_events',
- // 'sfwd-courses', - add more CPT's if needed
- );
- $new_post_types = array_merge($post_types, $custom_post_types);
- return $new_post_types;
- }
- /* Tribe add category after the title in list views and list widgets */
- function tribe_add_category ( ) {
- $cats = get_the_terms( get_the_ID(), Tribe__Events__Main::TAXONOMY);
- if ( empty($cats) ) return false;
- $cat_titles = array();
- foreach( $cats as $i ) {
- $cat_titles[] = $i->name;
- }
- // adjust markup if needed
- echo '<p>' . implode(', ', $cat_titles) . '</p>';
- }
- // you can also use tribe_events_before_the_event_title
- add_action( 'tribe_events_before_the_event_title', 'tribe_add_category' );
- // you can also use tribe_events_list_widget_before_the_event_title
- add_action( 'tribe_events_list_widget_before_the_event_title', 'tribe_add_category' );
- /**
- * Set the events per page on photo view.
- */
- function tribe_photo_posts_per_page( $value, $name, $default ){
- if ( 'postsPerPage' === $name && tribe_is_photo() ) {
- $value = '30';
- }
- return $value;
- }
- add_filter( 'tribe_get_option', 'tribe_photo_posts_per_page', 10, 3 );
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement