if (!function_exists('n7_golf_club_theme_shortcodes_setup')) { add_action( 'n7_golf_club_action_before_init_theme', 'n7_golf_club_theme_shortcodes_setup', 1 ); function n7_golf_club_theme_shortcodes_setup() { add_filter('n7_golf_club_filter_googlemap_styles', 'n7_golf_club_theme_shortcodes_googlemap_styles'); } } // Add theme-specific Google map styles if ( !function_exists( 'n7_golf_club_theme_shortcodes_googlemap_styles' ) ) { function n7_golf_club_theme_shortcodes_googlemap_styles($list) { $list['simple'] = esc_html__('Simple', 'n7-golf-club'); $list['greyscale'] = esc_html__('Greyscale', 'n7-golf-club'); $list['inverse'] = esc_html__('Inverse', 'n7-golf-club'); $list['dark'] = esc_html__('Minimal Gray', 'n7-golf-club'); return $list; } } ?> /** * N7 Golf Club Framework: date and time manipulations * * @package n7_golf_club * @since n7_golf_club 1.0 */ // Disable direct call if ( ! defined( 'ABSPATH' ) ) { exit; } // Convert date from MySQL format (YYYY-mm-dd) to Date (dd.mm.YYYY) if (!function_exists('n7_golf_club_sql_to_date')) { function n7_golf_club_sql_to_date($str) { return (trim($str)=='' || trim($str)=='0000-00-00' ? '' : trim(n7_golf_club_substr($str,8,2).'.'.n7_golf_club_substr($str,5,2).'.'.n7_golf_club_substr($str,0,4).' '.n7_golf_club_substr($str,11))); } } // Convert date from Date format (dd.mm.YYYY) to MySQL format (YYYY-mm-dd) if (!function_exists('n7_golf_club_date_to_sql')) { function n7_golf_club_date_to_sql($str) { if (trim($str)=='') return ''; $str = strtr(trim($str),'/\-,','....'); if (trim($str)=='00.00.0000' || trim($str)=='00.00.00') return ''; $pos = n7_golf_club_strpos($str,'.'); $d=trim(n7_golf_club_substr($str,0,$pos)); $str=n7_golf_club_substr($str,$pos+1); $pos = n7_golf_club_strpos($str,'.'); $m=trim(n7_golf_club_substr($str,0,$pos)); $y=trim(n7_golf_club_substr($str,$pos+1)); $y=($y<50?$y+2000:($y<1900?$y+1900:$y)); return ''.($y).'-'.(n7_golf_club_strlen($m)<2?'0':'').($m).'-'.(n7_golf_club_strlen($d)<2?'0':'').($d); } } // Return difference or date if (!function_exists('n7_golf_club_get_date_or_difference')) { function n7_golf_club_get_date_or_difference($dt1, $dt2=null, $max_days=-1) { static $gmt_offset = 999; if ($gmt_offset==999) $gmt_offset = (int) get_option('gmt_offset'); if ($max_days < 0) $max_days = n7_golf_club_get_theme_option('show_date_after', 30); if ($dt2 == null) $dt2 = date('Y-m-d H:i:s'); $dt2n = strtotime($dt2)+$gmt_offset*3600; $dt1n = strtotime($dt1); if (is_numeric($dt1n) && is_numeric($dt2n)) { $diff = $dt2n - $dt1n; $days = floor($diff / (24*3600)); if (abs($days) < $max_days) return sprintf($days >= 0 ? esc_html__('%s ago', 'n7-golf-club') : esc_html__('in %s', 'n7-golf-club'), n7_golf_club_get_date_difference($days >= 0 ? $dt1 : $dt2, $days >= 0 ? $dt2 : $dt1)); else return n7_golf_club_get_date_translations(date(get_option('date_format'), $dt1n)); } else return n7_golf_club_get_date_translations($dt1); } } // Difference between two dates if (!function_exists('n7_golf_club_get_date_difference')) { function n7_golf_club_get_date_difference($dt1, $dt2=null, $short=1, $sec = false) { static $gmt_offset = 999; if ($gmt_offset==999) $gmt_offset = (int) get_option('gmt_offset'); if ($dt2 == null) $dt2n = time()+$gmt_offset*3600; else $dt2n = strtotime($dt2)+$gmt_offset*3600; $dt1n = strtotime($dt1); if (is_numeric($dt1n) && is_numeric($dt2n)) { $diff = $dt2n - $dt1n; $days = floor($diff / (24*3600)); $months = floor($days / 30); $diff -= $days * 24 * 3600; $hours = floor($diff / 3600); $diff -= $hours * 3600; $min = floor($diff / 60); $diff -= $min * 60; $rez = ''; if ($months > 0 && $short == 2) $rez .= ($rez!='' ? ' ' : '') . sprintf($months > 1 ? esc_html__('%s months', 'n7-golf-club') : esc_html__('%s month', 'n7-golf-club'), $months); if ($days > 0 && ($short < 2 || $rez=='')) $rez .= ($rez!='' ? ' ' : '') . sprintf($days > 1 ? esc_html__('%s days', 'n7-golf-club') : esc_html__('%s day', 'n7-golf-club'), $days); if ((!$short || $rez=='') && $hours > 0) $rez .= ($rez!='' ? ' ' : '') . sprintf($hours > 1 ? esc_html__('%s hours', 'n7-golf-club') : esc_html__('%s hour', 'n7-golf-club'), $hours); if ((!$short || $rez=='') && $min > 0) $rez .= ($rez!='' ? ' ' : '') . sprintf($min > 1 ? esc_html__('%s minutes', 'n7-golf-club') : esc_html__('%s minute', 'n7-golf-club'), $min); if ($sec || $rez=='') $rez .= $rez!='' || $sec ? (' ' . sprintf($diff > 1 ? esc_html__('%s seconds', 'n7-golf-club') : esc_html__('%s second', 'n7-golf-club'), $diff)) : esc_html__('less then minute', 'n7-golf-club'); return $rez; } else return $dt1; } } // Prepare month names in date for translation if (!function_exists('n7_golf_club_get_date_translations')) { function n7_golf_club_get_date_translations($dt) { return str_replace( array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'), array( esc_html__('January', 'n7-golf-club'), esc_html__('February', 'n7-golf-club'), esc_html__('March', 'n7-golf-club'), esc_html__('April', 'n7-golf-club'), esc_html__('May', 'n7-golf-club'), esc_html__('June', 'n7-golf-club'), esc_html__('July', 'n7-golf-club'), esc_html__('August', 'n7-golf-club'), esc_html__('September', 'n7-golf-club'), esc_html__('October', 'n7-golf-club'), esc_html__('November', 'n7-golf-club'), esc_html__('December', 'n7-golf-club'), esc_html__('Jan', 'n7-golf-club'), esc_html__('Feb', 'n7-golf-club'), esc_html__('Mar', 'n7-golf-club'), esc_html__('Apr', 'n7-golf-club'), esc_html__('May', 'n7-golf-club'), esc_html__('Jun', 'n7-golf-club'), esc_html__('Jul', 'n7-golf-club'), esc_html__('Aug', 'n7-golf-club'), esc_html__('Sep', 'n7-golf-club'), esc_html__('Oct', 'n7-golf-club'), esc_html__('Nov', 'n7-golf-club'), esc_html__('Dec', 'n7-golf-club'), ), $dt); } } ?> /** * N7 Golf Club Framework: ini-files manipulations * * @package n7_golf_club * @since n7_golf_club 1.0 */ // Disable direct call if ( ! defined( 'ABSPATH' ) ) { exit; } // Get value by name from .ini-file if (!function_exists('n7_golf_club_ini_get_value')) { function n7_golf_club_ini_get_value($file, $name, $defa='') { if (!is_array($file)) { if (file_exists($file)) { $file = n7_golf_club_fga($file); } else return $defa; } $name = n7_golf_club_strtolower($name); $rez = $defa; for ($i=0; $i /* Essential Grid support functions ------------------------------------------------------------------------------- */ // Theme init if (!function_exists('n7_golf_club_essgrids_theme_setup')) { add_action( 'n7_golf_club_action_before_init_theme', 'n7_golf_club_essgrids_theme_setup', 1 ); function n7_golf_club_essgrids_theme_setup() { // Register shortcode in the shortcodes list if (n7_golf_club_exists_essgrids()) { if (is_admin()) { add_filter( 'n7_golf_club_filter_importer_options', 'n7_golf_club_essgrids_importer_set_options', 10, 1 ); add_action( 'n7_golf_club_action_importer_params', 'n7_golf_club_essgrids_importer_show_params', 10, 1 ); add_action( 'n7_golf_club_action_importer_clear_tables', 'n7_golf_club_essgrids_importer_clear_tables', 10, 2 ); add_action( 'n7_golf_club_action_importer_import', 'n7_golf_club_essgrids_importer_import', 10, 2 ); add_filter( 'n7_golf_club_filter_importer_import_row', 'n7_golf_club_essgrids_importer_check_row', 9, 4); add_action( 'n7_golf_club_action_importer_import_fields', 'n7_golf_club_essgrids_importer_import_fields', 10, 1 ); } } if (is_admin()) { add_filter( 'n7_golf_club_filter_importer_required_plugins', 'n7_golf_club_essgrids_importer_required_plugins', 10, 2 ); add_filter( 'n7_golf_club_filter_required_plugins', 'n7_golf_club_essgrids_required_plugins' ); } } } // Check if Ess. Grid installed and activated if ( !function_exists( 'n7_golf_club_exists_essgrids' ) ) { function n7_golf_club_exists_essgrids() { return defined('EG_PLUGIN_PATH'); //return class_exists('Essential_Grid'); //return is_plugin_active('essential-grid/essential-grid.php'); } } // Filter to add in the required plugins list if ( !function_exists( 'n7_golf_club_essgrids_required_plugins' ) ) { //Handler of add_filter('n7_golf_club_filter_required_plugins', 'n7_golf_club_essgrids_required_plugins'); function n7_golf_club_essgrids_required_plugins($list=array()) { if (in_array('essgrids', n7_golf_club_storage_get('required_plugins'))) { $path = n7_golf_club_get_file_dir('plugins/install/essential-grid.zip'); if (file_exists($path)) { $list[] = array( 'name' => 'Essential Grid', 'slug' => 'essential-grid', 'source' => $path, 'required' => false ); } } return $list; } } // One-click import support //------------------------------------------------------------------------ // Check in the required plugins if ( !function_exists( 'n7_golf_club_essgrids_importer_required_plugins' ) ) { //Handler of add_filter( 'n7_golf_club_filter_importer_required_plugins', 'n7_golf_club_essgrids_importer_required_plugins', 10, 2 ); function n7_golf_club_essgrids_importer_required_plugins($not_installed='', $list='') { if (n7_golf_club_strpos($list, 'essgrids')!==false && !n7_golf_club_exists_essgrids() ) $not_installed .= '
'.esc_html__('Essential Grids', 'n7-golf-club'); return $not_installed; } } // Set plugin's specific importer options if ( !function_exists( 'n7_golf_club_essgrids_importer_set_options' ) ) { //Handler of add_filter( 'n7_golf_club_filter_importer_options', 'n7_golf_club_essgrids_importer_set_options', 10, 1 ); function n7_golf_club_essgrids_importer_set_options($options=array()) { if ( in_array('essgrids', n7_golf_club_storage_get('required_plugins')) && n7_golf_club_exists_essgrids() ) { if (is_array($options['files']) && count($options['files']) > 0) { foreach ($options['files'] as $k => $v) { $options['files'][$k]['file_with_essgrids'] = str_replace('name.ext', 'ess_grid.json', $v['file_with_']); } } } return $options; } } // Add checkbox to the one-click importer if ( !function_exists( 'n7_golf_club_essgrids_importer_show_params' ) ) { //Handler of add_action( 'n7_golf_club_action_importer_params', 'n7_golf_club_essgrids_importer_show_params', 10, 1 ); function n7_golf_club_essgrids_importer_show_params($importer) { $importer->show_importer_params(array( 'slug' => 'essgrids', 'title' => esc_html__('Import Essential Grid', 'n7-golf-club'), 'part' => 1 )); } } // Clear tables if ( !function_exists( 'n7_golf_club_essgrids_importer_clear_tables' ) ) { //Handler of add_action( 'n7_golf_club_action_importer_clear_tables', 'n7_golf_club_essgrids_importer_clear_tables', 10, 2 ); function n7_golf_club_essgrids_importer_clear_tables($importer, $clear_tables) { if (n7_golf_club_exists_essgrids() && in_array('essgrids', n7_golf_club_storage_get('required_plugins'))) { if (strpos($clear_tables, 'essgrids')!==false) { if ($importer->options['debug']) dfl(__('Clear Essential Grid tables', 'n7-golf-club')); global $wpdb; $res = $wpdb->query("TRUNCATE TABLE " . esc_sql($wpdb->prefix) . Essential_Grid::TABLE_GRID); if ( is_wp_error( $res ) ) dfl( sprintf(__( 'Failed truncate table "%s". Error message: %s', 'n7-golf-club' ), Essential_Grid::TABLE_GRID, $res->get_error_message()) ); } } } } // Import posts if ( !function_exists( 'n7_golf_club_essgrids_importer_import' ) ) { //add_action( 'n7_golf_club_action_importer_import', 'n7_golf_club_essgrids_importer_import', 10, 2 ); function n7_golf_club_essgrids_importer_import($importer, $action) { if ( $action == 'import_essgrids' ) { if ( ($txt = $importer->get_file($importer->options['files'][$importer->options['demo_type']]['file_with_essgrids'])) != '') { $data = json_decode($txt, true); try { $im = new Essential_Grid_Import(); // Prepare arrays with overwrite flags $tmp = array(); if (is_array($data) && count($data) > 0) { foreach ($data as $k=>$v) { if ($k=='grids') { $name = 'grids'; $name_1= 'grid'; $name_id='id'; } else if ($k=='skins') { $name = 'skins'; $name_1= 'skin'; $name_id='id'; } else if ($k=='elements') { $name = 'elements'; $name_1= 'element'; $name_id='id'; } else if ($k=='navigation-skins') { $name = 'navigation-skins'; $name1= 'nav-skin'; $name_id='id'; } else if ($k=='punch-fonts') { $name = 'punch-fonts'; $name1= 'punch-fonts'; $name_id='handle'; } else if ($k=='custom-meta') { $name = 'custom-meta'; $name1= 'custom-meta'; $name_id='handle'; } if ($k=='global-css') { $tmp['import-global-styles'] = "on"; $tmp['global-styles-overwrite'] = "append"; } else { $tmp['import-'.$name] = "true"; $tmp['import-'.$name.'-'.$name_id] = array(); if (is_array($v) && count($v) > 0) { foreach ($v as $v1) { $tmp['import-'.$name.'-'.$name_id][] = $v1[$name_id]; $tmp[$name_1.'-overwrite-'.$name_id] = 'append'; } } } } } $im->set_overwrite_data($tmp); //set overwrite data global to class $skins = isset($data['skins']) ? $data['skins'] : ''; if (!empty($skins) && is_array($skins)){ $skins_ids = isset($tmp['import-skins-id']) ? $tmp['import-skins-id'] : ''; $skins_imported = $im->import_skins($skins, $skins_ids); } $navigation_skins = isset($data['navigation-skins']) ? $data['navigation-skins'] : ''; if (!empty($navigation_skins) && is_array($navigation_skins)){ $navigation_skins_ids = isset($tmp['import-navigation-skins-id']) ? $tmp['import-navigation-skins-id'] : ''; $navigation_skins_imported = $im->import_navigation_skins($navigation_skins, $navigation_skins_ids); } $grids = isset($data['grids']) ? $data['grids'] : ''; if (!empty($grids) && is_array($grids)){ $grids_ids = isset($tmp['import-grids-id']) ? $tmp['import-grids-id'] : ''; $grids_imported = $im->import_grids($grids, $grids_ids); } $elements = isset($data['elements']) ? $data['elements'] : ''; if (!empty($elements) && is_array($elements)){ $elements_ids = isset($tmp['import-elements-id']) ? $tmp['import-elements-id'] : ''; $elements_imported = $im->import_elements($elements, $elements_ids); } $custom_metas = isset($data['custom-meta']) ? $data['custom-meta'] : ''; if (!empty($custom_metas) && is_array($custom_metas)){ $custom_metas_handle = isset($tmp['import-custom-meta-handle']) ? $tmp['import-custom-meta-handle'] : ''; $custom_metas_imported = $im->import_custom_meta($custom_metas, $custom_metas_handle); } $custom_fonts = isset($data['punch-fonts']) ? $data['punch-fonts'] : ''; if (!empty($custom_fonts) && is_array($custom_fonts)){ $custom_fonts_handle = isset($tmp['import-punch-fonts-handle']) ? $tmp['import-punch-fonts-handle'] : ''; $custom_fonts_imported = $im->import_punch_fonts($custom_fonts, $custom_fonts_handle); } if (isset($tmp['import-global-styles']) && $tmp['import-global-styles'] == 'on'){ $global_css = isset($data['global-css']) ? $data['global-css'] : ''; $global_styles_imported = $im->import_global_styles($tglobal_css); } if ($importer->options['debug']) dfl( __('Essential Grid import complete', 'n7-golf-club') ); } catch (Exception $d) { $msg = sprintf(esc_html__('Essential Grid import error: %s', 'n7-golf-club'), $d->getMessage()); $importer->response['error'] = $msg; if ($importer->options['debug']) dfl( $msg ); } } } } } // Check if the row will be imported if ( !function_exists( 'n7_golf_club_essgrids_importer_check_row' ) ) { //Handler of add_filter('n7_golf_club_filter_importer_import_row', 'n7_golf_club_essgrids_importer_check_row', 9, 4); function n7_golf_club_essgrids_importer_check_row($flag, $table, $row, $list) { if ($flag || strpos($list, 'essgrids')===false) return $flag; if ( n7_golf_club_exists_essgrids() ) { if ($table == 'posts') $flag = $row['post_type']==apply_filters('essgrid_PunchPost_custom_post_type', 'essential_grid'); } return $flag; } } // Display import progress if ( !function_exists( 'n7_golf_club_essgrids_importer_import_fields' ) ) { //Handler of add_action( 'n7_golf_club_action_importer_import_fields', 'n7_golf_club_essgrids_importer_import_fields', 10, 1 ); function n7_golf_club_essgrids_importer_import_fields($importer) { $importer->show_importer_fields(array( 'slug' => 'essgrids', 'title' => esc_html__('Essential Grid', 'n7-golf-club') )); } } ?> /* The GDPR compliance support functions ------------------------------------------------------------------------------- */ // Theme init if (!function_exists('n7_golf_club_gdpr_compliance_theme_setup')) { add_action( 'n7_golf_club_action_before_init_theme', 'n7_golf_club_gdpr_compliance_theme_setup', 1 ); function n7_golf_club_gdpr_compliance_theme_setup() { if (is_admin()) { add_filter( 'n7_golf_club_filter_required_plugins', 'n7_golf_club_gdpr_compliance_required_plugins' ); } } } // Check if Instagram Widget installed and activated if ( !function_exists( 'n7_golf_club_exists_gdpr_compliance' ) ) { function n7_golf_club_exists_gdpr_compliance() { return defined( 'WP_GDPR_C_SLUG' ); } } // Filter to add in the required plugins list if ( !function_exists( 'n7_golf_club_gdpr_compliance_required_plugins' ) ) { //Handler of add_filter('n7_golf_club_filter_required_plugins', 'n7_golf_club_gdpr_compliance_required_plugins'); function n7_golf_club_gdpr_compliance_required_plugins($list=array()) { if (in_array('wp-gdpr-compliance', (array)n7_golf_club_storage_get('required_plugins'))) $list[] = array( 'name' => esc_html__('WP GDPR Compliance', 'n7-golf-club'), 'slug' => 'wp-gdpr-compliance', 'required' => false ); return $list; } } /* Mail Chimp support functions ------------------------------------------------------------------------------- */ // Theme init if (!function_exists('n7_golf_club_mailchimp_theme_setup')) { add_action( 'n7_golf_club_action_before_init_theme', 'n7_golf_club_mailchimp_theme_setup', 1 ); function n7_golf_club_mailchimp_theme_setup() { if (n7_golf_club_exists_mailchimp()) { if (is_admin()) { add_filter( 'n7_golf_club_filter_importer_options', 'n7_golf_club_mailchimp_importer_set_options' ); add_action( 'n7_golf_club_action_importer_params', 'n7_golf_club_mailchimp_importer_show_params', 10, 1 ); add_filter( 'n7_golf_club_filter_importer_import_row', 'n7_golf_club_mailchimp_importer_check_row', 9, 4); } } if (is_admin()) { add_filter( 'n7_golf_club_filter_importer_required_plugins', 'n7_golf_club_mailchimp_importer_required_plugins', 10, 2 ); add_filter( 'n7_golf_club_filter_required_plugins', 'n7_golf_club_mailchimp_required_plugins' ); } } } // Check if Instagram Feed installed and activated if ( !function_exists( 'n7_golf_club_exists_mailchimp' ) ) { function n7_golf_club_exists_mailchimp() { return function_exists('mc4wp_load_plugin'); } } // Filter to add in the required plugins list if ( !function_exists( 'n7_golf_club_mailchimp_required_plugins' ) ) { //Handler of add_filter('n7_golf_club_filter_required_plugins', 'n7_golf_club_mailchimp_required_plugins'); function n7_golf_club_mailchimp_required_plugins($list=array()) { if (in_array('mailchimp', n7_golf_club_storage_get('required_plugins'))) $list[] = array( 'name' => 'MailChimp for WP', 'slug' => 'mailchimp-for-wp', 'required' => false ); return $list; } } // One-click import support //------------------------------------------------------------------------ // Check Mail Chimp in the required plugins if ( !function_exists( 'n7_golf_club_mailchimp_importer_required_plugins' ) ) { //Handler of add_filter( 'n7_golf_club_filter_importer_required_plugins', 'n7_golf_club_mailchimp_importer_required_plugins', 10, 2 ); function n7_golf_club_mailchimp_importer_required_plugins($not_installed='', $list='') { if (n7_golf_club_strpos($list, 'mailchimp')!==false && !n7_golf_club_exists_mailchimp() ) $not_installed .= '
' . esc_html__('Mail Chimp', 'n7-golf-club'); return $not_installed; } } // Set options for one-click importer if ( !function_exists( 'n7_golf_club_mailchimp_importer_set_options' ) ) { //Handler of add_filter( 'n7_golf_club_filter_importer_options', 'n7_golf_club_mailchimp_importer_set_options' ); function n7_golf_club_mailchimp_importer_set_options($options=array()) { if ( in_array('mailchimp', n7_golf_club_storage_get('required_plugins')) && n7_golf_club_exists_mailchimp() ) { // Add slugs to export options for this plugin $options['additional_options'][] = 'mc4wp_lite_checkbox'; $options['additional_options'][] = 'mc4wp_lite_form'; } return $options; } } // Add checkbox to the one-click importer if ( !function_exists( 'n7_golf_club_mailchimp_importer_show_params' ) ) { //Handler of add_action( 'n7_golf_club_action_importer_params', 'n7_golf_club_mailchimp_importer_show_params', 10, 1 ); function n7_golf_club_mailchimp_importer_show_params($importer) { if ( n7_golf_club_exists_mailchimp() && in_array('mailchimp', n7_golf_club_storage_get('required_plugins')) ) { $importer->show_importer_params(array( 'slug' => 'mailchimp', 'title' => esc_html__('Import MailChimp for WP', 'n7-golf-club'), 'part' => 1 )); } } } // Check if the row will be imported if ( !function_exists( 'n7_golf_club_mailchimp_importer_check_row' ) ) { //Handler of add_filter('n7_golf_club_filter_importer_import_row', 'n7_golf_club_mailchimp_importer_check_row', 9, 4); function n7_golf_club_mailchimp_importer_check_row($flag, $table, $row, $list) { if ($flag || strpos($list, 'mailchimp')===false) return $flag; if ( n7_golf_club_exists_mailchimp() ) { if ($table == 'posts') $flag = $row['post_type']=='mc4wp-form'; } return $flag; } } ?> /* Mega Main Menu support functions ------------------------------------------------------------------------------- */ // Theme init if (!function_exists('n7_golf_club_megamenu_theme_setup')) { add_action( 'n7_golf_club_action_before_init_theme', 'n7_golf_club_megamenu_theme_setup', 1 ); function n7_golf_club_megamenu_theme_setup() { if (n7_golf_club_exists_megamenu()) { if (is_admin()) { add_filter( 'n7_golf_club_filter_importer_options', 'n7_golf_club_megamenu_importer_set_options' ); } } if (is_admin()) { add_filter( 'n7_golf_club_filter_importer_required_plugins', 'n7_golf_club_megamenu_importer_required_plugins', 10, 2 ); add_filter( 'n7_golf_club_filter_required_plugins', 'n7_golf_club_megamenu_required_plugins' ); } } } // Check if MegaMenu installed and activated if ( !function_exists( 'n7_golf_club_exists_megamenu' ) ) { function n7_golf_club_exists_megamenu() { return class_exists('mega_main_init'); } } // Filter to add in the required plugins list if ( !function_exists( 'n7_golf_club_megamenu_required_plugins' ) ) { //Handler of add_filter('n7_golf_club_filter_required_plugins', 'n7_golf_club_megamenu_required_plugins'); function n7_golf_club_megamenu_required_plugins($list=array()) { if (in_array('mega_main_menu', n7_golf_club_storage_get('required_plugins'))) { $path = n7_golf_club_get_file_dir('plugins/install/mega_main_menu.zip'); if (file_exists($path)) { $list[] = array( 'name' => 'Mega Main Menu', 'slug' => 'mega_main_menu', 'source' => $path, 'required' => false ); } } return $list; } } // One-click import support //------------------------------------------------------------------------ // Check Mega Menu in the required plugins if ( !function_exists( 'n7_golf_club_megamenu_importer_required_plugins' ) ) { //Handler of add_filter( 'n7_golf_club_filter_importer_required_plugins', 'n7_golf_club_megamenu_importer_required_plugins', 10, 2 ); function n7_golf_club_megamenu_importer_required_plugins($not_installed='', $list='') { if (n7_golf_club_strpos($list, 'mega_main_menu')!==false && !n7_golf_club_exists_megamenu()) $not_installed .= '
' . esc_html__('Mega Main Menu', 'n7-golf-club'); return $not_installed; } } // Set options for one-click importer if ( !function_exists( 'n7_golf_club_megamenu_importer_set_options' ) ) { //Handler of add_filter( 'n7_golf_club_filter_importer_options', 'n7_golf_club_megamenu_importer_set_options' ); function n7_golf_club_megamenu_importer_set_options($options=array()) { if ( in_array('mega_main_menu', n7_golf_club_storage_get('required_plugins')) && n7_golf_club_exists_megamenu() ) { // Add slugs to export options for this plugin $options['additional_options'][] = 'mega_main_menu_options'; } return $options; } } ?> /* Tribe Events (TE) support functions ------------------------------------------------------------------------------- */ // Theme init if (!function_exists('n7_golf_club_tribe_events_theme_setup')) { add_action( 'n7_golf_club_action_before_init_theme', 'n7_golf_club_tribe_events_theme_setup', 1 ); function n7_golf_club_tribe_events_theme_setup() { if (n7_golf_club_exists_tribe_events()) { // Detect current page type, taxonomy and title (for custom post_types use priority < 10 to fire it handles early, than for standard post types) add_filter('n7_golf_club_filter_get_blog_type', 'n7_golf_club_tribe_events_get_blog_type', 9, 2); add_filter('n7_golf_club_filter_get_blog_title', 'n7_golf_club_tribe_events_get_blog_title', 9, 2); add_filter('n7_golf_club_filter_get_current_taxonomy', 'n7_golf_club_tribe_events_get_current_taxonomy', 9, 2); add_filter('n7_golf_club_filter_is_taxonomy', 'n7_golf_club_tribe_events_is_taxonomy', 9, 2); add_filter('n7_golf_club_filter_get_stream_page_title', 'n7_golf_club_tribe_events_get_stream_page_title', 9, 2); add_filter('n7_golf_club_filter_get_stream_page_link', 'n7_golf_club_tribe_events_get_stream_page_link', 9, 2); add_filter('n7_golf_club_filter_get_stream_page_id', 'n7_golf_club_tribe_events_get_stream_page_id', 9, 2); add_filter('n7_golf_club_filter_get_period_links', 'n7_golf_club_tribe_events_get_period_links', 9, 3); add_filter('n7_golf_club_filter_detect_inheritance_key', 'n7_golf_club_tribe_events_detect_inheritance_key', 9, 1); add_action( 'n7_golf_club_action_add_styles', 'n7_golf_club_tribe_events_frontend_scripts' ); add_filter('n7_golf_club_filter_list_post_types', 'n7_golf_club_tribe_events_list_post_types', 10, 1); add_filter('n7_golf_club_filter_post_date', 'n7_golf_club_tribe_events_post_date', 9, 3); add_filter('n7_golf_club_filter_add_sort_order', 'n7_golf_club_tribe_events_add_sort_order', 10, 3); add_filter('n7_golf_club_filter_orderby_need', 'n7_golf_club_tribe_events_orderby_need', 9, 2); // Advanced Calendar filters add_filter('n7_golf_club_filter_calendar_get_month_link', 'n7_golf_club_tribe_events_calendar_get_month_link', 9, 2); add_filter('n7_golf_club_filter_calendar_get_prev_month', 'n7_golf_club_tribe_events_calendar_get_prev_month', 9, 2); add_filter('n7_golf_club_filter_calendar_get_next_month', 'n7_golf_club_tribe_events_calendar_get_next_month', 9, 2); add_filter('n7_golf_club_filter_calendar_get_curr_month_posts', 'n7_golf_club_tribe_events_calendar_get_curr_month_posts', 9, 2); // Add Google API key to the map's link add_filter('tribe_events_google_maps_api', 'n7_golf_club_tribe_events_google_maps_api'); // Add query params to show events in the blog add_filter( 'posts_join', 'n7_golf_club_tribe_events_posts_join', 10, 2 ); add_filter( 'getarchives_join', 'n7_golf_club_tribe_events_getarchives_join', 10, 2 ); add_filter( 'posts_where', 'n7_golf_club_tribe_events_posts_where', 10, 2 ); add_filter( 'getarchives_where', 'n7_golf_club_tribe_events_getarchives_where', 10, 2 ); // Extra column for events lists if (n7_golf_club_get_theme_option('show_overriden_posts')=='yes') { add_filter('manage_edit-'.Tribe__Events__Main::POSTTYPE.'_columns', 'n7_golf_club_post_add_options_column', 9); add_filter('manage_'.Tribe__Events__Main::POSTTYPE.'_posts_custom_column', 'n7_golf_club_post_fill_options_column', 9, 2); } // Register shortcode [trx_events] in the list add_action('n7_golf_club_action_shortcodes_list', 'n7_golf_club_tribe_events_reg_shortcodes'); if (function_exists('n7_golf_club_exists_visual_composer') && n7_golf_club_exists_visual_composer()) add_action('n7_golf_club_action_shortcodes_list_vc', 'n7_golf_club_tribe_events_reg_shortcodes_vc'); // One-click installer if (is_admin()) { add_filter( 'n7_golf_club_filter_importer_options', 'n7_golf_club_tribe_events_importer_set_options' ); } } if (is_admin()) { add_filter( 'n7_golf_club_filter_importer_required_plugins', 'n7_golf_club_tribe_events_importer_required_plugins', 10, 2 ); add_filter( 'n7_golf_club_filter_required_plugins', 'n7_golf_club_tribe_events_required_plugins' ); } } } if ( !function_exists( 'n7_golf_club_tribe_events_settings_theme_setup2' ) ) { add_action( 'n7_golf_club_action_before_init_theme', 'n7_golf_club_tribe_events_settings_theme_setup2', 3 ); function n7_golf_club_tribe_events_settings_theme_setup2() { if (n7_golf_club_exists_tribe_events()) { n7_golf_club_add_theme_inheritance( array('tribe_events' => array( 'stream_template' => 'tribe-events/default-template', 'single_template' => '', 'taxonomy' => array(Tribe__Events__Main::TAXONOMY), 'taxonomy_tags' => array(), 'post_type' => array( Tribe__Events__Main::POSTTYPE, Tribe__Events__Main::VENUE_POST_TYPE, Tribe__Events__Main::ORGANIZER_POST_TYPE ), 'override' => 'post' ) ) ); // Add Tribe Events specific options in the Theme Options n7_golf_club_storage_set_array_before('options', 'partition_reviews', array( "partition_tribe_events" => array( "title" => __('Events', 'n7-golf-club'), "icon" => "iconadmin-clock", "type" => "partition"), "info_tribe_events_1" => array( "title" => __('Events settings', 'n7-golf-club'), "desc" => __('Set up events posts behaviour in the blog.', 'n7-golf-club'), "type" => "info"), "show_tribe_events_in_blog" => array( "title" => __('Show events in the blog', 'n7-golf-club'), "desc" => __("Show events in stream pages (blog, archives) or only in special pages", 'n7-golf-club'), "divider" => false, "std" => "yes", "options" => n7_golf_club_get_options_param('list_yes_no'), "type" => "switch") ) ); } } } // Check if Tribe Events installed and activated if (!function_exists('n7_golf_club_exists_tribe_events')) { function n7_golf_club_exists_tribe_events() { return class_exists( 'Tribe__Events__Main' ); } } // Return true, if current page is any TE page if ( !function_exists( 'n7_golf_club_is_tribe_events_page' ) ) { function n7_golf_club_is_tribe_events_page() { $is = false; if (n7_golf_club_exists_tribe_events()) { $is = in_array(n7_golf_club_storage_get('page_template'), array('tribe-events/default-template')); if (!$is) { if (n7_golf_club_storage_empty('pre_query')) { if (!is_search()) $is = tribe_is_event() || tribe_is_event_query() || tribe_is_event_category() || tribe_is_event_venue() || tribe_is_event_organizer(); } else { $is = n7_golf_club_storage_get_obj_property('pre_query', 'tribe_is_event') || n7_golf_club_storage_get_obj_property('pre_query', 'tribe_is_multi_posttype') || n7_golf_club_storage_get_obj_property('pre_query', 'tribe_is_event_category') || n7_golf_club_storage_get_obj_property('pre_query', 'tribe_is_event_venue') || n7_golf_club_storage_get_obj_property('pre_query', 'tribe_is_event_organizer') || n7_golf_club_storage_get_obj_property('pre_query', 'tribe_is_event_query') || n7_golf_club_storage_get_obj_property('pre_query', 'tribe_is_past'); } } } return $is; } } // Filter to detect current page inheritance key if ( !function_exists( 'n7_golf_club_tribe_events_detect_inheritance_key' ) ) { //Handler of add_filter('n7_golf_club_filter_detect_inheritance_key', 'n7_golf_club_tribe_events_detect_inheritance_key', 9, 1); function n7_golf_club_tribe_events_detect_inheritance_key($key) { if (!empty($key)) return $key; return n7_golf_club_is_tribe_events_page() ? 'tribe_events' : ''; } } // Filter to detect current page slug if ( !function_exists( 'n7_golf_club_tribe_events_get_blog_type' ) ) { //Handler of add_filter('n7_golf_club_filter_get_blog_type', 'n7_golf_club_tribe_events_get_blog_type', 10, 2); function n7_golf_club_tribe_events_get_blog_type($page, $query=null) { if (!empty($page)) return $page; if (!is_search() && n7_golf_club_is_tribe_events_page()) { //$tribe_ecp = Tribe__Events__Main::instance(); if (/*tribe_is_day()*/ isset($query->query_vars['eventDisplay']) && $query->query_vars['eventDisplay']=='day') $page = 'tribe_day'; else if (/*tribe_is_month()*/ isset($query->query_vars['eventDisplay']) && $query->query_vars['eventDisplay']=='month') $page = 'tribe_month'; else if (is_single()) $page = 'tribe_event'; else if (/*tribe_is_event_venue()*/ isset($query->tribe_is_event_venue) && $query->tribe_is_event_venue) $page = 'tribe_venue'; else if (/*tribe_is_event_organizer()*/ isset($query->tribe_is_event_organizer) && $query->tribe_is_event_organizer) $page = 'tribe_organizer'; else if (/* tribe_is_event_category()*/ isset($query->tribe_is_event_category) && $query->tribe_is_event_category) $page = 'tribe_category'; else if (/*is_tax($tribe_ecp->get_event_taxonomy())*/ is_tag()) $page = 'tribe_tag'; else if (isset($query->query_vars['eventDisplay']) && $query->query_vars['eventDisplay']=='upcoming') $page = 'tribe_list'; else $page = 'tribe'; } return $page; } } // Filter to detect current page title if ( !function_exists( 'n7_golf_club_tribe_events_get_blog_title' ) ) { //Handler of add_filter('n7_golf_club_filter_get_blog_title', 'n7_golf_club_tribe_events_get_blog_title', 10, 2); function n7_golf_club_tribe_events_get_blog_title($title, $page) { if (!empty($title)) return $title; if ( n7_golf_club_strpos($page, 'tribe')!==false ) { //return tribe_get_events_title(); if ( $page == 'tribe_category' ) { $cat = get_term_by( 'slug', get_query_var( 'tribe_events_cat' ), 'tribe_events_cat', ARRAY_A); $title = $cat['name']; } else if ( $page == 'tribe_tag' ) { $title = sprintf( esc_html__( 'Tag: %s', 'n7-golf-club' ), single_tag_title( '', false ) ); } else if ( $page == 'tribe_venue' ) { $title = sprintf( esc_html__( 'Venue: %s', 'n7-golf-club' ), tribe_get_venue()); } else if ( $page == 'tribe_organizer' ) { $title = sprintf( esc_html__( 'Organizer: %s', 'n7-golf-club' ), tribe_get_organizer()); } else if ( $page == 'tribe_day' ) { $title = sprintf( esc_html__( 'Daily Events: %s', 'n7-golf-club' ), date_i18n(tribe_get_date_format(true), strtotime(get_query_var( 'start_date' ))) ); } else if ( $page == 'tribe_month' ) { $title = sprintf( esc_html__( 'Monthly Events: %s', 'n7-golf-club' ), date_i18n(tribe_get_option('monthAndYearFormat', 'F Y' ), strtotime(tribe_get_month_view_date()))); } else if ( $page == 'tribe_event' ) { $title = n7_golf_club_get_post_title(); } else { $title = esc_html__( 'All Events', 'n7-golf-club' ); } } return $title; } } // Filter to detect stream page title if ( !function_exists( 'n7_golf_club_tribe_events_get_stream_page_title' ) ) { //Handler of add_filter('n7_golf_club_filter_get_stream_page_title', 'n7_golf_club_tribe_events_get_stream_page_title', 9, 2); function n7_golf_club_tribe_events_get_stream_page_title($title, $page) { if (!empty($title)) return $title; if (n7_golf_club_strpos($page, 'tribe')!==false) { if (($page_id = n7_golf_club_tribe_events_get_stream_page_id(0, $page)) > 0) $title = n7_golf_club_get_post_title($page_id); else $title = esc_html__( 'All Events', 'n7-golf-club'); } return $title; } } // Filter to detect stream page ID if ( !function_exists( 'n7_golf_club_tribe_events_get_stream_page_id' ) ) { //Handler of add_filter('n7_golf_club_filter_get_stream_page_id', 'n7_golf_club_tribe_events_get_stream_page_id', 9, 2); function n7_golf_club_tribe_events_get_stream_page_id($id, $page) { if (!empty($id)) return $id; if (n7_golf_club_strpos($page, 'tribe')!==false) $id = n7_golf_club_get_template_page_id('tribe-events/default-template'); return $id; } } // Filter to detect stream page URL if ( !function_exists( 'n7_golf_club_tribe_events_get_stream_page_link' ) ) { //Handler of add_filter('n7_golf_club_filter_get_stream_page_link', 'n7_golf_club_tribe_events_get_stream_page_link', 9, 2); function n7_golf_club_tribe_events_get_stream_page_link($url, $page) { if (!empty($url)) return $url; if (n7_golf_club_strpos($page, 'tribe')!==false) $url = tribe_get_events_link(); return $url; } } // Filter to return breadcrumbs links to the parent period if ( !function_exists( 'n7_golf_club_tribe_events_get_period_links' ) ) { //Handler of add_filter('n7_golf_club_filter_get_period_links', 'n7_golf_club_tribe_events_get_period_links', 9, 3); function n7_golf_club_tribe_events_get_period_links($links, $page, $delimiter='') { if (!empty($links)) return $links; global $post; if ($page == 'tribe_day' && is_object($post)) $links = '' . date_i18n(tribe_get_option('monthAndYearFormat', 'F Y' ), strtotime(tribe_get_month_view_date())) . ''; return $links; } } // Filter to detect current taxonomy if ( !function_exists( 'n7_golf_club_tribe_events_get_current_taxonomy' ) ) { //Handler of add_filter('n7_golf_club_filter_get_current_taxonomy', 'n7_golf_club_tribe_events_get_current_taxonomy', 9, 2); function n7_golf_club_tribe_events_get_current_taxonomy($tax, $page) { if (!empty($tax)) return $tax; if ( n7_golf_club_strpos($page, 'tribe')!==false ) { $tax = Tribe__Events__Main::TAXONOMY; } return $tax; } } // Return taxonomy name (slug) if current page is this taxonomy page if ( !function_exists( 'n7_golf_club_tribe_events_is_taxonomy' ) ) { //Handler of add_filter('n7_golf_club_filter_is_taxonomy', 'n7_golf_club_tribe_events_is_taxonomy', 10, 2); function n7_golf_club_tribe_events_is_taxonomy($tax, $query=null) { if (!empty($tax)) return $tax; else return $query && isset($query->tribe_is_event_category) && $query->tribe_is_event_category || is_tax(Tribe__Events__Main::TAXONOMY) ? Tribe__Events__Main::TAXONOMY : ''; } } // Add custom post type into list if ( !function_exists( 'n7_golf_club_tribe_events_list_post_types' ) ) { //Handler of add_filter('n7_golf_club_filter_list_post_types', 'n7_golf_club_tribe_events_list_post_types', 10, 1); function n7_golf_club_tribe_events_list_post_types($list) { if (n7_golf_club_get_theme_option('show_tribe_events_in_blog')=='yes') { $list['tribe_events'] = esc_html__('Events', 'n7-golf-club'); } return $list; } } // Return previous month and year with published posts if ( !function_exists( 'n7_golf_club_tribe_events_calendar_get_month_link' ) ) { //Handler of add_filter('n7_golf_club_filter_calendar_get_month_link', 'n7_golf_club_tribe_events_calendar_get_month_link', 9, 2); function n7_golf_club_tribe_events_calendar_get_month_link($link, $opt) { if (!empty($opt['posts_types']) && in_array(Tribe__Events__Main::POSTTYPE, $opt['posts_types']) && count($opt['posts_types'])==1) { $events = Tribe__Events__Main::instance(); $link = $events->getLink('month', ($opt['year']).'-'.($opt['month']), null); } return $link; } } // Return previous month and year with published posts if ( !function_exists( 'n7_golf_club_tribe_events_calendar_get_prev_month' ) ) { //Handler of add_filter('n7_golf_club_filter_calendar_get_prev_month', 'n7_golf_club_tribe_events_calendar_get_prev_month', 9, 2); function n7_golf_club_tribe_events_calendar_get_prev_month($prev, $opt) { if (!empty($opt['posts_types']) && !in_array(Tribe__Events__Main::POSTTYPE, $opt['posts_types'])) return $prev; if (!empty($prev['done']) && in_array(Tribe__Events__Main::POSTTYPE, $prev['done'])) return $prev; $args = array( 'suppress_filters' => true, 'post_type' => Tribe__Events__Main::POSTTYPE, 'post_status' => current_user_can('read_private_pages') && current_user_can('read_private_posts') ? array('publish', 'private') : 'publish', 'posts_per_page' => 1, 'ignore_sticky_posts' => true, 'orderby' => 'meta_value', 'meta_key' => '_EventStartDate', 'order' => 'desc', 'meta_query' => array( array( 'key' => '_EventStartDate', 'value' => ($opt['year']).'-'.($opt['month']).'-01', 'compare' => '<', 'type' => 'DATE' ) ) ); $q = new WP_Query($args); $month = $year = 0; if ($q->have_posts()) { while ($q->have_posts()) { $q->the_post(); $dt = strtotime(get_post_meta(get_the_ID(), '_EventStartDate', true)); $year = date('Y', $dt); $month = date('m', $dt); } wp_reset_postdata(); } if (empty($prev) || ($year+$month > 0 && ($prev['year']+$prev['month']==0 || ($prev['year']).($prev['month']) < ($year).($month)))) { $prev['year'] = $year; $prev['month'] = $month; } if (empty($prev['done'])) $prev['done'] = array(); $prev['done'][] = Tribe__Events__Main::POSTTYPE; return $prev; } } // Return next month and year with published posts if ( !function_exists( 'n7_golf_club_tribe_events_calendar_get_next_month' ) ) { //Handler of add_filter('n7_golf_club_filter_calendar_get_next_month', 'n7_golf_club_tribe_events_calendar_get_next_month', 9, 2); function n7_golf_club_tribe_events_calendar_get_next_month($next, $opt) { if (!empty($opt['posts_types']) && !in_array(Tribe__Events__Main::POSTTYPE, $opt['posts_types'])) return $next; if (!empty($next['done']) && in_array(Tribe__Events__Main::POSTTYPE, $next['done'])) return $next; $args = array( 'suppress_filters' => true, 'post_type' => Tribe__Events__Main::POSTTYPE, 'post_status' => current_user_can('read_private_pages') && current_user_can('read_private_posts') ? array('publish', 'private') : 'publish', 'posts_per_page' => 1, 'orderby' => 'meta_value', 'ignore_sticky_posts' => true, 'meta_key' => '_EventStartDate', 'order' => 'asc', 'meta_query' => array( array( 'key' => '_EventStartDate', 'value' => ($opt['year']).'-'.($opt['month']).'-'.($opt['last_day']).' 23:59:59', 'compare' => '>', 'type' => 'DATE' ) ) ); $q = new WP_Query($args); $month = $year = 0; if ($q->have_posts()) { while ($q->have_posts()) { $q->the_post(); $dt = strtotime(get_post_meta(get_the_ID(), '_EventStartDate', true)); $year = date('Y', $dt); $month = date('m', $dt); } wp_reset_postdata(); } if (empty($next) || ($year+$month > 0 && ($next['year']+$next['month'] ==0 || ($next['year']).($next['month']) > ($year).($month)))) { $next['year'] = $year; $next['month'] = $month; } if (empty($next['done'])) $next['done'] = array(); $next['done'][] = Tribe__Events__Main::POSTTYPE; return $next; } } // Return current month published posts if ( !function_exists( 'n7_golf_club_tribe_events_calendar_get_curr_month_posts' ) ) { //Handler of add_filter('n7_golf_club_filter_calendar_get_curr_month_posts', 'n7_golf_club_tribe_events_calendar_get_curr_month_posts', 9, 2); function n7_golf_club_tribe_events_calendar_get_curr_month_posts($posts, $opt) { if (!empty($opt['posts_types']) && !in_array(Tribe__Events__Main::POSTTYPE, $opt['posts_types'])) return $posts; if (!empty($posts['done']) && in_array(Tribe__Events__Main::POSTTYPE, $posts['done'])) return $posts; $args = array( 'suppress_filters' => true, 'post_type' => Tribe__Events__Main::POSTTYPE, 'post_status' => current_user_can('read_private_pages') && current_user_can('read_private_posts') ? array('publish', 'private') : 'publish', 'posts_per_page' => -1, 'ignore_sticky_posts' => true, 'orderby' => 'meta_value', 'meta_key' => '_EventStartDate', 'order' => 'asc', 'meta_query' => array( array( 'key' => '_EventStartDate', 'value' => array(($opt['year']).'-'.($opt['month']).'-01', ($opt['year']).'-'.($opt['month']).'-'.($opt['last_day']).' 23:59:59'), 'compare' => 'BETWEEN', 'type' => 'DATE' ) ) ); $q = new WP_Query($args); if ($q->have_posts()) { if (empty($posts)) $posts = array(); $events = Tribe__Events__Main::instance(); while ($q->have_posts()) { $q->the_post(); $dt = strtotime(get_post_meta(get_the_ID(), '_EventStartDate', true)); $day = (int) date('d', $dt); $title = get_the_title(); //apply_filters('the_title', get_the_title()); if (empty($posts[$day])) $posts[$day] = array(); if (empty($posts[$day]['link']) && count($opt['posts_types'])==1) $posts[$day]['link'] = $events->getLink('day', ($opt['year']).'-'.($opt['month']).'-'.($day), null); if (empty($posts[$day]['titles'])) $posts[$day]['titles'] = $title; else $posts[$day]['titles'] = is_int($posts[$day]['titles']) ? $posts[$day]['titles']+1 : 2; if (empty($posts[$day]['posts'])) $posts[$day]['posts'] = array(); $posts[$day]['posts'][] = array( 'post_id' => get_the_ID(), 'post_type' => get_post_type(), 'post_date' => date(get_option('date_format'), $dt), 'post_title' => $title, 'post_link' => get_permalink() ); } wp_reset_postdata(); } if (empty($posts['done'])) $posts['done'] = array(); $posts['done'][] = Tribe__Events__Main::POSTTYPE; return $posts; } } // Enqueue Tribe Events custom styles if ( !function_exists( 'n7_golf_club_tribe_events_frontend_scripts' ) ) { //Handler of add_action( 'n7_golf_club_action_add_styles', 'n7_golf_club_tribe_events_frontend_scripts' ); function n7_golf_club_tribe_events_frontend_scripts() { //global $wp_styles; //$wp_styles->done[] = 'tribe-events-custom-jquery-styles'; wp_deregister_style('tribe-events-custom-jquery-styles'); if (file_exists(n7_golf_club_get_file_dir('css/plugin.tribe-events.css'))) wp_enqueue_style( 'n7-golf-club-plugin.tribe-events-style', n7_golf_club_get_file_url('css/plugin.tribe-events.css'), array(), null ); if (file_exists(n7_golf_club_get_file_dir('css/tribe-events-full-mobile.min.css'))) wp_enqueue_style( 'tribe-events-full-mobile', n7_golf_club_get_file_url('css/tribe-events-full-mobile.min.css'), array(), null ); } } // Before main content if ( !function_exists( 'n7_golf_club_tribe_events_wrapper_start' ) ) { //Handler of add_filter('tribe_events_before_html', 'n7_golf_club_tribe_events_wrapper_start'); function n7_golf_club_tribe_events_wrapper_start($html) { return '
' . ($html); } } // After main content if ( !function_exists( 'n7_golf_club_tribe_events_wrapper_end' ) ) { //Handler of add_filter('tribe_events_after_html', 'n7_golf_club_tribe_events_wrapper_end'); function n7_golf_club_tribe_events_wrapper_end($html) { return $html . '
'; } } // Add sorting parameter in query arguments if (!function_exists('n7_golf_club_tribe_events_add_sort_order')) { function n7_golf_club_tribe_events_add_sort_order($q, $orderby, $order) { if ($orderby == 'event_date') { $q['orderby'] = 'meta_value'; $q['meta_key'] = '_EventStartDate'; } return $q; } } // Return false if current plugin not need theme orderby setting if ( !function_exists( 'n7_golf_club_tribe_events_orderby_need' ) ) { //Handler of add_filter('n7_golf_club_filter_orderby_need', 'n7_golf_club_tribe_events_orderby_need', 9, 1); function n7_golf_club_tribe_events_orderby_need($need) { if ($need == false || n7_golf_club_storage_empty('pre_query')) return $need; else { return ! ( n7_golf_club_storage_get_obj_property('pre_query', 'tribe_is_event') || n7_golf_club_storage_get_obj_property('pre_query', 'tribe_is_multi_posttype') || n7_golf_club_storage_get_obj_property('pre_query', 'tribe_is_event_category') || n7_golf_club_storage_get_obj_property('pre_query', 'tribe_is_event_venue') || n7_golf_club_storage_get_obj_property('pre_query', 'tribe_is_event_organizer') || n7_golf_club_storage_get_obj_property('pre_query', 'tribe_is_event_query') || n7_golf_club_storage_get_obj_property('pre_query', 'tribe_is_past') ); } } } /* Query params to show Events in blog stream -------------------------------------------------------------------------- */ // Pre query: Join tables into main query if ( !function_exists( 'n7_golf_club_tribe_events_posts_join' ) ) { //Handler of add_action( 'posts_join', 'n7_golf_club_tribe_events_posts_join', 10, 2 ); function n7_golf_club_tribe_events_posts_join($join_sql, $query) { if (n7_golf_club_get_theme_option('show_tribe_events_in_blog')=='yes' && !is_admin() && $query->is_main_query()) { if ($query->is_day || $query->is_month || $query->is_year || $query->is_archive || $query->is_posts_page) { global $wpdb; $join_sql .= " LEFT JOIN " . esc_sql($wpdb->postmeta) . " AS _tribe_events_meta ON " . esc_sql($wpdb->posts) . ".ID = _tribe_events_meta.post_id AND _tribe_events_meta.meta_key = '_EventStartDate'"; } } return $join_sql; } } // Pre query: Join tables into archives widget query if ( !function_exists( 'n7_golf_club_tribe_events_getarchives_join' ) ) { //Handler of add_action( 'getarchives_join', 'n7_golf_club_tribe_events_getarchives_join', 10, 2 ); function n7_golf_club_tribe_events_getarchives_join($join_sql, $r) { if (n7_golf_club_get_theme_option('show_tribe_events_in_blog')=='yes') { global $wpdb; $join_sql .= " LEFT JOIN " . esc_sql($wpdb->postmeta) . " AS _tribe_events_meta ON " . esc_sql($wpdb->posts) . ".ID = _tribe_events_meta.post_id AND _tribe_events_meta.meta_key = '_EventStartDate'"; } return $join_sql; } } // Pre query: Where section into main query if ( !function_exists( 'n7_golf_club_tribe_events_posts_where' ) ) { //Handler of add_action( 'posts_where', 'n7_golf_club_tribe_events_posts_where', 10, 2 ); function n7_golf_club_tribe_events_posts_where($where_sql, $query) { if (n7_golf_club_get_theme_option('show_tribe_events_in_blog')=='yes' && !is_admin() && $query->is_main_query()) { if ($query->is_day || $query->is_month || $query->is_year || $query->is_archive || $query->is_posts_page) { global $wpdb; $where_sql .= " OR (1=1"; // Posts status if ((!isset($_REQUEST['preview']) || $_REQUEST['preview']!='true') && (!isset($_REQUEST['vc_editable']) || $_REQUEST['vc_editable']!='true')) { if (current_user_can('read_private_pages') && current_user_can('read_private_posts')) $where_sql .= " AND (" . esc_sql($wpdb->posts) . ".post_status='publish' OR " . esc_sql($wpdb->posts) . ".post_status='private')"; else $where_sql .= " AND " . esc_sql($wpdb->posts) . ".post_status='publish'"; } // Posts type and date $dt = $query->get('m'); $y = $query->get('year'); if (empty($y)) $y = (int) n7_golf_club_substr($dt, 0, 4); $where_sql .= " AND " . esc_sql($wpdb->posts) . ".post_type='".esc_sql(Tribe__Events__Main::POSTTYPE)."' AND YEAR(_tribe_events_meta.meta_value)=".esc_sql($y); if ($query->is_month || $query->is_day) { $m = $query->get('monthnum'); if (empty($m)) $m = (int) n7_golf_club_substr($dt, 4, 2); $where_sql .= " AND MONTH(_tribe_events_meta.meta_value)=".esc_sql($m); } if ($query->is_day) { $d = $query->get('day'); if (empty($d)) $d = (int) n7_golf_club_substr($dt, 6, 2); $where_sql .= " AND DAYOFMONTH(_tribe_events_meta.meta_value)=".esc_sql($d); } $where_sql .= ')'; } } return $where_sql; } } // Pre query: Where section into archives widget query if ( !function_exists( 'n7_golf_club_tribe_events_getarchives_where' ) ) { //Handler of add_action( 'getarchives_where', 'n7_golf_club_tribe_events_getarchives_where', 10, 2 ); function n7_golf_club_tribe_events_getarchives_where($where_sql, $r) { if (n7_golf_club_get_theme_option('show_tribe_events_in_blog')=='yes') { global $wpdb; // Posts type and date $where_sql .= " OR " . esc_sql($wpdb->posts) . ".post_type='".esc_sql(Tribe__Events__Main::POSTTYPE)."'"; } return $where_sql; } } // Return tribe_events start date instead post publish date if ( !function_exists( 'n7_golf_club_tribe_events_post_date' ) ) { //Handler of add_filter('n7_golf_club_filter_post_date', 'n7_golf_club_tribe_events_post_date', 9, 3); function n7_golf_club_tribe_events_post_date($post_date, $post_id, $post_type) { if ($post_type == Tribe__Events__Main::POSTTYPE) { $post_date = get_post_meta($post_id, '_EventStartDate', true); } return $post_date; } } // Filter to add in the required plugins list if ( !function_exists( 'n7_golf_club_tribe_events_required_plugins' ) ) { //Handler of add_filter('n7_golf_club_filter_required_plugins', 'n7_golf_club_tribe_events_required_plugins'); function n7_golf_club_tribe_events_required_plugins($list=array()) { if (in_array('tribe_events', n7_golf_club_storage_get('required_plugins'))) $list[] = array( 'name' => 'Tribe Events Calendar', 'slug' => 'the-events-calendar', 'required' => false ); return $list; } } // Add parameters to URL if (!function_exists('n7_golf_club_add_to_url')) { function n7_golf_club_add_to_url($url, $prm) { if (is_array($prm) && count($prm) > 0) { $separator = n7_golf_club_strpos($url, '?')===false ? '?' : '&'; foreach ($prm as $k=>$v) { $url .= $separator . urlencode($k) . '=' . urlencode($v); $separator = '&'; } } return $url; } } // Add Google API key to the map's link if ( !function_exists( 'n7_golf_club_tribe_events_google_maps_api' ) ) { //Handler of add_filter('tribe_events_google_maps_api', 'n7_golf_club_tribe_events_google_maps_api'); function n7_golf_club_tribe_events_google_maps_api($url) { $api_key = n7_golf_club_get_theme_option('api_google'); if ($api_key) { $url = n7_golf_club_add_to_url($url, array( 'key' => $api_key )); } return $url; } } // One-click import support //------------------------------------------------------------------------ // Check in the required plugins if ( !function_exists( 'n7_golf_club_tribe_events_importer_required_plugins' ) ) { //Handler of add_filter( 'n7_golf_club_filter_importer_required_plugins', 'n7_golf_club_tribe_events_importer_required_plugins', 10, 2 ); function n7_golf_club_tribe_events_importer_required_plugins($not_installed='', $list='') { if (n7_golf_club_strpos($list, 'tribe_events')!==false && !n7_golf_club_exists_tribe_events() ) $not_installed .= '
Tribe Events Calendar'; return $not_installed; } } // Set options for one-click importer if ( !function_exists( 'n7_golf_club_tribe_events_importer_set_options' ) ) { //Handler of add_filter( 'n7_golf_club_filter_importer_options', 'n7_golf_club_tribe_events_importer_set_options' ); function n7_golf_club_tribe_events_importer_set_options($options=array()) { if ( in_array('tribe_events', n7_golf_club_storage_get('required_plugins')) && n7_golf_club_exists_tribe_events() ) { // Add slugs to export options for this plugin $options['additional_options'][] = 'tribe_events_calendar_options'; } return $options; } } // Shortcodes //------------------------------------------------------------------------ /* [trx_events id="unique_id" columns="4" count="4" style="events-1|events-2|..." title="Block title" subtitle="xxx" description="xxxxxx"] */ if ( !function_exists( 'n7_golf_club_sc_events' ) ) { function n7_golf_club_sc_events($atts, $content=null){ if (n7_golf_club_in_shortcode_blogger()) return ''; extract(n7_golf_club_html_decode(shortcode_atts(array( // Individual params "style" => "events-1", "columns" => 4, "slider" => "no", "slides_space" => 0, "controls" => "no", "interval" => "", "autoheight" => "no", "align" => "", "ids" => "", "cat" => "", "count" => 4, "offset" => "", "orderby" => "event_date", "order" => "asc", "readmore" => esc_html__('Read more', 'n7-golf-club'), "title" => "", "subtitle" => "", "description" => "", "link_caption" => esc_html__('Learn more', 'n7-golf-club'), "link" => '', "scheme" => '', // Common params "id" => "", "class" => "", "animation" => "", "css" => "", "width" => "", "height" => "", "top" => "", "bottom" => "", "left" => "", "right" => "" ), $atts))); if (empty($id)) $id = "sc_events_".str_replace('.', '', mt_rand()); if (empty($width)) $width = "100%"; if (!empty($height) && n7_golf_club_param_is_on($autoheight)) $autoheight = "no"; if (empty($interval)) $interval = mt_rand(5000, 10000); $class .= ($class ? ' ' : '') . n7_golf_club_get_css_position_as_classes($top, $right, $bottom, $left); $ws = n7_golf_club_get_css_dimensions_from_values($width); $hs = n7_golf_club_get_css_dimensions_from_values('', $height); $css .= ($hs) . ($ws); $count = max(1, (int) $count); $columns = max(1, min(12, (int) $columns)); if ($count < $columns) $columns = $count; if (n7_golf_club_param_is_on($slider)) n7_golf_club_enqueue_slider('swiper'); $output = '' . '' . (!empty($subtitle) ? '
' . trim(n7_golf_club_strmacros($subtitle)) . '
' : '') . (!empty($title) ? '

' . trim(n7_golf_club_strmacros($title)) . '

' : '') . (!empty($description) ? '
' . trim(n7_golf_club_strmacros($description)) . '
' : '') . (n7_golf_club_param_is_on($slider) ? ('
0 ? ' data-interval="'.esc_attr($interval).'"' : '') . ($columns > 1 ? ' data-slides-per-view="' . esc_attr($columns) . '"' : '') . ($slides_space > 0 ? ' data-slides-space="' . esc_attr($slides_space) . '"' : '') . '>' . '
') : ($columns > 1 ? '
' : '') ); $content = do_shortcode($content); global $post; if (!empty($ids)) { $posts = explode(',', $ids); $count = count($posts); } $args = array( 'post_type' => Tribe__Events__Main::POSTTYPE, 'post_status' => 'publish', 'posts_per_page' => $count, 'ignore_sticky_posts' => true, 'order' => $order=='asc' ? 'asc' : 'desc', 'readmore' => $readmore ); if ($offset > 0 && empty($ids)) { $args['offset'] = $offset; } $args = n7_golf_club_query_add_sort_order($args, $orderby, $order); $args = n7_golf_club_query_add_posts_and_cats($args, $ids, Tribe__Events__Main::POSTTYPE, $cat, Tribe__Events__Main::TAXONOMY); $query = new WP_Query( $args ); $post_number = 0; while ( $query->have_posts() ) { $query->the_post(); $post_number++; $args = array( 'layout' => $style, 'show' => false, 'number' => $post_number, 'posts_on_page' => ($count > 0 ? $count : $query->found_posts), "descr" => n7_golf_club_get_custom_option('post_excerpt_maxlength'.($columns > 1 ? '_masonry' : '')), "orderby" => $orderby, 'content' => false, 'terms_list' => false, 'readmore' => $readmore, 'columns_count' => $columns, 'slider' => $slider, 'tag_id' => $id ? $id . '_' . $post_number : '', 'tag_class' => '', 'tag_animation' => '', 'tag_css' => '', 'tag_css_wh' => $ws . $hs ); $output .= n7_golf_club_show_post_layout($args); } wp_reset_postdata(); if (n7_golf_club_param_is_on($slider)) { $output .= '
' . '
' . '
' . '
'; } else if ($columns > 1) { $output .= '
'; } $output .= (!empty($link) ? '
'.n7_golf_club_do_shortcode('[trx_button link="'.esc_url($link).'" icon="icon-right"]'.esc_html($link_caption).'[/trx_button]').'
' : '') . '' . ''; // Add template specific scripts and styles do_action('n7_golf_club_action_blog_scripts', $style); return apply_filters('n7_golf_club_shortcode_output', $output, 'trx_events', $atts, $content); } n7_golf_club_require_shortcode('trx_events', 'n7_golf_club_sc_events'); } // ---------------------------------- [/trx_events] --------------------------------------- // Add [trx_events] in the shortcodes list if (!function_exists('n7_golf_club_tribe_events_reg_shortcodes')) { //Handler of add_filter('n7_golf_club_action_shortcodes_list', 'n7_golf_club_tribe_events_reg_shortcodes'); function n7_golf_club_tribe_events_reg_shortcodes() { if (n7_golf_club_storage_isset('shortcodes')) { $groups = n7_golf_club_get_list_terms(false, Tribe__Events__Main::TAXONOMY); $styles = n7_golf_club_get_list_templates('events'); $sorting = array( "event_date"=> esc_html__("Start Date", 'n7-golf-club'), "title" => esc_html__("Alphabetically", 'n7-golf-club'), "random" => esc_html__("Random", 'n7-golf-club') ); $controls = n7_golf_club_get_list_slider_controls(); n7_golf_club_sc_map_before('trx_form', "trx_events", array( "title" => esc_html__("Events", 'n7-golf-club'), "desc" => esc_html__("Insert events list in your page (post)", 'n7-golf-club'), "decorate" => true, "container" => false, "params" => array( "title" => array( "title" => esc_html__("Title", 'n7-golf-club'), "desc" => esc_html__("Title for the block", 'n7-golf-club'), "value" => "", "type" => "text" ), "subtitle" => array( "title" => esc_html__("Subtitle", 'n7-golf-club'), "desc" => esc_html__("Subtitle for the block", 'n7-golf-club'), "value" => "", "type" => "text" ), "description" => array( "title" => esc_html__("Description", 'n7-golf-club'), "desc" => esc_html__("Short description for the block", 'n7-golf-club'), "value" => "", "type" => "textarea" ), "style" => array( "title" => esc_html__("Style", 'n7-golf-club'), "desc" => esc_html__("Select style to display events list", 'n7-golf-club'), "value" => "events-1", "type" => "select", "options" => $styles ), "columns" => array( "title" => esc_html__("Columns", 'n7-golf-club'), "desc" => esc_html__("How many columns use to show events list", 'n7-golf-club'), "value" => 4, "min" => 2, "max" => 6, "step" => 1, "type" => "spinner" ), "scheme" => array( "title" => esc_html__("Color scheme", 'n7-golf-club'), "desc" => esc_html__("Select color scheme for this block", 'n7-golf-club'), "value" => "", "type" => "checklist", "options" => n7_golf_club_get_sc_param('schemes') ), "slider" => array( "title" => esc_html__("Slider", 'n7-golf-club'), "desc" => esc_html__("Use slider to show events", 'n7-golf-club'), "dependency" => array( 'style' => array('events-1') ), "value" => "no", "type" => "switch", "options" => n7_golf_club_get_sc_param('yes_no') ), "controls" => array( "title" => esc_html__("Controls", 'n7-golf-club'), "desc" => esc_html__("Slider controls style and position", 'n7-golf-club'), "dependency" => array( 'slider' => array('yes') ), "divider" => true, "value" => "", "type" => "checklist", "dir" => "horizontal", "options" => $controls ), "slides_space" => array( "title" => esc_html__("Space between slides", 'n7-golf-club'), "desc" => esc_html__("Size of space (in px) between slides", 'n7-golf-club'), "dependency" => array( 'slider' => array('yes') ), "value" => 0, "min" => 0, "max" => 100, "step" => 10, "type" => "spinner" ), "interval" => array( "title" => esc_html__("Slides change interval", 'n7-golf-club'), "desc" => esc_html__("Slides change interval (in milliseconds: 1000ms = 1s)", 'n7-golf-club'), "dependency" => array( 'slider' => array('yes') ), "value" => 7000, "step" => 500, "min" => 0, "type" => "spinner" ), "autoheight" => array( "title" => esc_html__("Autoheight", 'n7-golf-club'), "desc" => esc_html__("Change whole slider's height (make it equal current slide's height)", 'n7-golf-club'), "dependency" => array( 'slider' => array('yes') ), "value" => "yes", "type" => "switch", "options" => n7_golf_club_get_sc_param('yes_no') ), "align" => array( "title" => esc_html__("Alignment", 'n7-golf-club'), "desc" => esc_html__("Alignment of the events block", 'n7-golf-club'), "divider" => true, "value" => "", "type" => "checklist", "dir" => "horizontal", "options" => n7_golf_club_get_sc_param('align') ), "cat" => array( "title" => esc_html__("Categories", 'n7-golf-club'), "desc" => esc_html__("Select categories (groups) to show events list. If empty - select events from any category (group) or from IDs list", 'n7-golf-club'), "divider" => true, "value" => "", "type" => "select", "style" => "list", "multiple" => true, "options" => n7_golf_club_array_merge(array(0 => esc_html__('- Select category -', 'n7-golf-club')), $groups) ), "count" => array( "title" => esc_html__("Number of posts", 'n7-golf-club'), "desc" => esc_html__("How many posts will be displayed? If used IDs - this parameter ignored.", 'n7-golf-club'), "value" => 4, "min" => 1, "max" => 100, "type" => "spinner" ), "offset" => array( "title" => esc_html__("Offset before select posts", 'n7-golf-club'), "desc" => esc_html__("Skip posts before select next part.", 'n7-golf-club'), "value" => 0, "min" => 0, "type" => "spinner" ), "orderby" => array( "title" => esc_html__("Post order by", 'n7-golf-club'), "desc" => esc_html__("Select desired posts sorting method", 'n7-golf-club'), "value" => "title", "type" => "select", "options" => $sorting ), "order" => array( "title" => esc_html__("Post order", 'n7-golf-club'), "desc" => esc_html__("Select desired posts order", 'n7-golf-club'), "value" => "asc", "type" => "switch", "size" => "big", "options" => n7_golf_club_get_sc_param('ordering') ), "ids" => array( "title" => esc_html__("Post IDs list", 'n7-golf-club'), "desc" => esc_html__("Comma separated list of posts ID. If set - parameters above are ignored!", 'n7-golf-club'), "value" => "", "type" => "text" ), "readmore" => array( "title" => esc_html__("Read more", 'n7-golf-club'), "desc" => esc_html__("Caption for the Read more link (if empty - link not showed)", 'n7-golf-club'), "value" => "", "type" => "text" ), "link" => array( "title" => esc_html__("Button URL", 'n7-golf-club'), "desc" => esc_html__("Link URL for the button at the bottom of the block", 'n7-golf-club'), "value" => "", "type" => "text" ), "link_caption" => array( "title" => esc_html__("Button caption", 'n7-golf-club'), "desc" => esc_html__("Caption for the button at the bottom of the block", 'n7-golf-club'), "value" => "", "type" => "text" ), "width" => n7_golf_club_shortcodes_width(), "height" => n7_golf_club_shortcodes_height(), "top" => n7_golf_club_get_sc_param('top'), "bottom" => n7_golf_club_get_sc_param('bottom'), "left" => n7_golf_club_get_sc_param('left'), "right" => n7_golf_club_get_sc_param('right'), "id" => n7_golf_club_get_sc_param('id'), "class" => n7_golf_club_get_sc_param('class'), "animation" => n7_golf_club_get_sc_param('animation'), "css" => n7_golf_club_get_sc_param('css') ) ) ); } } } // Add [trx_events] in the VC shortcodes list if (!function_exists('n7_golf_club_tribe_events_reg_shortcodes_vc')) { //Handler of add_filter('n7_golf_club_action_shortcodes_list_vc', 'n7_golf_club_tribe_events_reg_shortcodes_vc'); function n7_golf_club_tribe_events_reg_shortcodes_vc() { $groups = n7_golf_club_get_list_terms(false, Tribe__Events__Main::TAXONOMY); $styles = n7_golf_club_get_list_templates('events'); $sorting = array( "event_date"=> esc_html__("Start Date", 'n7-golf-club'), "title" => esc_html__("Alphabetically", 'n7-golf-club'), "random" => esc_html__("Random", 'n7-golf-club') ); $controls = n7_golf_club_get_list_slider_controls(); // Events vc_map( array( "base" => "trx_events", "name" => esc_html__("Events", 'n7-golf-club'), "description" => esc_html__("Insert events list", 'n7-golf-club'), "category" => esc_html__('Content', 'n7-golf-club'), "icon" => 'icon_trx_events', "class" => "trx_sc_single trx_sc_events", "content_element" => true, "is_container" => false, "show_settings_on_create" => true, "params" => array( array( "param_name" => "style", "heading" => esc_html__("Style", 'n7-golf-club'), "description" => esc_html__("Select style to display events list", 'n7-golf-club'), "class" => "", "admin_label" => true, "std" => "events-1", "value" => array_flip($styles), "type" => "dropdown" ), array( "param_name" => "scheme", "heading" => esc_html__("Color scheme", 'n7-golf-club'), "description" => esc_html__("Select color scheme for this block", 'n7-golf-club'), "admin_label" => true, "class" => "", "value" => array_flip(n7_golf_club_get_sc_param('schemes')), "type" => "dropdown" ), array( "param_name" => "slider", "heading" => esc_html__("Slider", 'n7-golf-club'), "description" => esc_html__("Use slider to show events", 'n7-golf-club'), "admin_label" => true, 'dependency' => array( 'element' => 'style', 'value' => 'events-1' ), "group" => esc_html__('Slider', 'n7-golf-club'), "class" => "", "std" => "no", "value" => array_flip(n7_golf_club_get_sc_param('yes_no')), "type" => "dropdown" ), array( "param_name" => "controls", "heading" => esc_html__("Controls", 'n7-golf-club'), "description" => esc_html__("Slider controls style and position", 'n7-golf-club'), "admin_label" => true, "group" => esc_html__('Slider', 'n7-golf-club'), 'dependency' => array( 'element' => 'slider', 'value' => 'yes' ), "class" => "", "std" => "no", "value" => array_flip($controls), "type" => "dropdown" ), array( "param_name" => "slides_space", "heading" => esc_html__("Space between slides", 'n7-golf-club'), "description" => esc_html__("Size of space (in px) between slides", 'n7-golf-club'), "admin_label" => true, "group" => esc_html__('Slider', 'n7-golf-club'), 'dependency' => array( 'element' => 'slider', 'value' => 'yes' ), "class" => "", "value" => "0", "type" => "textfield" ), array( "param_name" => "interval", "heading" => esc_html__("Slides change interval", 'n7-golf-club'), "description" => esc_html__("Slides change interval (in milliseconds: 1000ms = 1s)", 'n7-golf-club'), "group" => esc_html__('Slider', 'n7-golf-club'), 'dependency' => array( 'element' => 'slider', 'value' => 'yes' ), "class" => "", "value" => "7000", "type" => "textfield" ), array( "param_name" => "autoheight", "heading" => esc_html__("Autoheight", 'n7-golf-club'), "description" => esc_html__("Change whole slider's height (make it equal current slide's height)", 'n7-golf-club'), "group" => esc_html__('Slider', 'n7-golf-club'), 'dependency' => array( 'element' => 'slider', 'value' => 'yes' ), "class" => "", "value" => array("Autoheight" => "yes" ), "type" => "checkbox" ), array( "param_name" => "align", "heading" => esc_html__("Alignment", 'n7-golf-club'), "description" => esc_html__("Alignment of the events block", 'n7-golf-club'), "class" => "", "value" => array_flip(n7_golf_club_get_sc_param('align')), "type" => "dropdown" ), array( "param_name" => "title", "heading" => esc_html__("Title", 'n7-golf-club'), "description" => esc_html__("Title for the block", 'n7-golf-club'), "admin_label" => true, "group" => esc_html__('Captions', 'n7-golf-club'), "class" => "", "value" => "", "type" => "textfield" ), array( "param_name" => "subtitle", "heading" => esc_html__("Subtitle", 'n7-golf-club'), "description" => esc_html__("Subtitle for the block", 'n7-golf-club'), "group" => esc_html__('Captions', 'n7-golf-club'), "class" => "", "value" => "", "type" => "textfield" ), array( "param_name" => "description", "heading" => esc_html__("Description", 'n7-golf-club'), "description" => esc_html__("Description for the block", 'n7-golf-club'), "group" => esc_html__('Captions', 'n7-golf-club'), "class" => "", "value" => "", "type" => "textarea" ), array( "param_name" => "cat", "heading" => esc_html__("Categories", 'n7-golf-club'), "description" => esc_html__("Select category to show events. If empty - select events from any category (group) or from IDs list", 'n7-golf-club'), "group" => esc_html__('Query', 'n7-golf-club'), "class" => "", "value" => array_flip(n7_golf_club_array_merge(array(0 => esc_html__('- Select category -', 'n7-golf-club')), $groups)), "type" => "dropdown" ), array( "param_name" => "columns", "heading" => esc_html__("Columns", 'n7-golf-club'), "description" => esc_html__("How many columns use to show events list", 'n7-golf-club'), "group" => esc_html__('Query', 'n7-golf-club'), "admin_label" => true, "class" => "", "value" => "4", "type" => "textfield" ), array( "param_name" => "count", "heading" => esc_html__("Number of posts", 'n7-golf-club'), "description" => esc_html__("How many posts will be displayed? If used IDs - this parameter ignored.", 'n7-golf-club'), "admin_label" => true, "group" => esc_html__('Query', 'n7-golf-club'), "class" => "", "value" => "4", "type" => "textfield" ), array( "param_name" => "offset", "heading" => esc_html__("Offset before select posts", 'n7-golf-club'), "description" => esc_html__("Skip posts before select next part.", 'n7-golf-club'), "group" => esc_html__('Query', 'n7-golf-club'), "class" => "", "value" => "0", "type" => "textfield" ), array( "param_name" => "orderby", "heading" => esc_html__("Post sorting", 'n7-golf-club'), "description" => esc_html__("Select desired posts sorting method", 'n7-golf-club'), "group" => esc_html__('Query', 'n7-golf-club'), "class" => "", "value" => array_flip($sorting), "type" => "dropdown" ), array( "param_name" => "order", "heading" => esc_html__("Post order", 'n7-golf-club'), "description" => esc_html__("Select desired posts order", 'n7-golf-club'), "group" => esc_html__('Query', 'n7-golf-club'), "class" => "", "value" => array_flip(n7_golf_club_get_sc_param('ordering')), "type" => "dropdown" ), array( "param_name" => "ids", "heading" => esc_html__("Event's IDs list", 'n7-golf-club'), "description" => esc_html__("Comma separated list of event's ID. If set - parameters above (category, count, order, etc.) are ignored!", 'n7-golf-club'), "group" => esc_html__('Query', 'n7-golf-club'), "class" => "", "value" => "", "type" => "textfield" ), array( "param_name" => "readmore", "heading" => esc_html__("Read more", 'n7-golf-club'), "description" => esc_html__("Caption for the Read more link (if empty - link not showed)", 'n7-golf-club'), "admin_label" => true, "group" => esc_html__('Captions', 'n7-golf-club'), "class" => "", "value" => "", "type" => "textfield" ), array( "param_name" => "link", "heading" => esc_html__("Button URL", 'n7-golf-club'), "description" => esc_html__("Link URL for the button at the bottom of the block", 'n7-golf-club'), "group" => esc_html__('Captions', 'n7-golf-club'), "class" => "", "value" => "", "type" => "textfield" ), array( "param_name" => "link_caption", "heading" => esc_html__("Button caption", 'n7-golf-club'), "description" => esc_html__("Caption for the button at the bottom of the block", 'n7-golf-club'), "group" => esc_html__('Captions', 'n7-golf-club'), "class" => "", "value" => "", "type" => "textfield" ), n7_golf_club_vc_width(), n7_golf_club_vc_height(), n7_golf_club_get_vc_param('margin_top'), n7_golf_club_get_vc_param('margin_bottom'), n7_golf_club_get_vc_param('margin_left'), n7_golf_club_get_vc_param('margin_right'), n7_golf_club_get_vc_param('id'), n7_golf_club_get_vc_param('class'), n7_golf_club_get_vc_param('animation'), n7_golf_club_get_vc_param('css') ) ) ); class WPBakeryShortCode_Trx_Events extends N7_GOLF_CLUB_VC_ShortCodeSingle {} } } ?> // Autoload layouts in this folder n7_golf_club_autoload_folder( 'templates/trx_services' ); ?> // Autoload layouts in this folder n7_golf_club_autoload_folder( 'templates/trx_team' ); ?> // Autoload layouts in this folder n7_golf_club_autoload_folder( 'templates/trx_testimonials' ); ?> /** * Template for Page 404 */ // Tribe Events hack - create empty post object global $post; if (!isset($post)) { $post = new stdClass(); $post->post_type = 'unknown'; } // End Tribe Events hack get_header(); n7_golf_club_show_post_layout( array('layout' => '404'), false ); get_footer(); ?>