/**
* ThemeREX Framework: Services post type settings
*
* @package themerex
* @since themerex 1.0
*/
// Theme init
if (!function_exists('fivestars_services_theme_setup')) {
add_action( 'fivestars_action_before_init_theme', 'fivestars_services_theme_setup' );
function fivestars_services_theme_setup() {
// 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('fivestars_filter_get_blog_type', 'fivestars_services_get_blog_type', 9, 2);
add_filter('fivestars_filter_get_blog_title', 'fivestars_services_get_blog_title', 9, 2);
add_filter('fivestars_filter_get_current_taxonomy', 'fivestars_services_get_current_taxonomy', 9, 2);
add_filter('fivestars_filter_is_taxonomy', 'fivestars_services_is_taxonomy', 9, 2);
add_filter('fivestars_filter_get_stream_page_title', 'fivestars_services_get_stream_page_title', 9, 2);
add_filter('fivestars_filter_get_stream_page_link', 'fivestars_services_get_stream_page_link', 9, 2);
add_filter('fivestars_filter_get_stream_page_id', 'fivestars_services_get_stream_page_id', 9, 2);
add_filter('fivestars_filter_query_add_filters', 'fivestars_services_query_add_filters', 9, 2);
add_filter('fivestars_filter_detect_inheritance_key','fivestars_services_detect_inheritance_key', 9, 1);
// Extra column for services lists
if (fivestars_get_theme_option('show_overriden_posts')=='yes') {
add_filter('manage_edit-services_columns', 'fivestars_post_add_options_column', 9);
add_filter('manage_services_posts_custom_column', 'fivestars_post_fill_options_column', 9, 2);
}
// Add shortcodes [trx_services] and [trx_services_item]
add_action('fivestars_action_shortcodes_list', 'fivestars_services_add_shortcodes');
add_action('fivestars_action_shortcodes_list_vc', 'fivestars_services_add_shortcodes_vc');
if (function_exists('fivestars_require_shortcode')) {
fivestars_require_shortcode('trx_services', 'fivestars_sc_services');
fivestars_require_shortcode('trx_services_item', 'fivestars_sc_services_item');
}
if (function_exists('fivestars_require_data')) {
// Prepare type "Team"
fivestars_require_data( 'post_type', 'services', array(
'label' => esc_html__( 'Service item', 'fivestars' ),
'description' => esc_html__( 'Service Description', 'fivestars' ),
'labels' => array(
'name' => _x( 'Services', 'Post Type General Name', 'fivestars' ),
'singular_name' => _x( 'Service item', 'Post Type Singular Name', 'fivestars' ),
'menu_name' => esc_html__( 'Services', 'fivestars' ),
'parent_item_colon' => esc_html__( 'Parent Item:', 'fivestars' ),
'all_items' => esc_html__( 'All Services', 'fivestars' ),
'view_item' => esc_html__( 'View Item', 'fivestars' ),
'add_new_item' => esc_html__( 'Add New Service', 'fivestars' ),
'add_new' => esc_html__( 'Add New', 'fivestars' ),
'edit_item' => esc_html__( 'Edit Item', 'fivestars' ),
'update_item' => esc_html__( 'Update Item', 'fivestars' ),
'search_items' => esc_html__( 'Search Item', 'fivestars' ),
'not_found' => esc_html__( 'Not found', 'fivestars' ),
'not_found_in_trash' => esc_html__( 'Not found in Trash', 'fivestars' ),
),
'supports' => array( 'title', 'excerpt', 'editor', 'author', 'thumbnail', 'comments', 'custom-fields'),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'menu_icon' => 'dashicons-info',
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 25,
'can_export' => true,
'has_archive' => false,
'exclude_from_search' => false,
'publicly_queryable' => true,
'query_var' => true,
'capability_type' => 'page',
'rewrite' => true
)
);
// Prepare taxonomy for team
fivestars_require_data( 'taxonomy', 'services_group', array(
'post_type' => array( 'services' ),
'hierarchical' => true,
'labels' => array(
'name' => _x( 'Services Group', 'taxonomy general name', 'fivestars' ),
'singular_name' => _x( 'Group', 'taxonomy singular name', 'fivestars' ),
'search_items' => esc_html__( 'Search Groups', 'fivestars' ),
'all_items' => esc_html__( 'All Groups', 'fivestars' ),
'parent_item' => esc_html__( 'Parent Group', 'fivestars' ),
'parent_item_colon' => esc_html__( 'Parent Group:', 'fivestars' ),
'edit_item' => esc_html__( 'Edit Group', 'fivestars' ),
'update_item' => esc_html__( 'Update Group', 'fivestars' ),
'add_new_item' => esc_html__( 'Add New Group', 'fivestars' ),
'new_item_name' => esc_html__( 'New Group Name', 'fivestars' ),
'menu_name' => esc_html__( 'Services Group', 'fivestars' ),
),
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'services_group' ),
)
);
}
}
}
if ( !function_exists( 'fivestars_services_settings_theme_setup2' ) ) {
add_action( 'fivestars_action_before_init_theme', 'fivestars_services_settings_theme_setup2', 3 );
function fivestars_services_settings_theme_setup2() {
// Add post type 'services' and taxonomy 'services_group' into theme inheritance list
fivestars_add_theme_inheritance( array('services' => array(
'stream_template' => 'blog-services',
'single_template' => 'single-services',
'taxonomy' => array('services_group'),
'taxonomy_tags' => array(),
'post_type' => array('services'),
'override' => 'page'
) )
);
}
}
// Return true, if current page is services page
if ( !function_exists( 'fivestars_is_services_page' ) ) {
function fivestars_is_services_page() {
return get_query_var('post_type')=='services' || is_tax('services_group') || (is_page() && fivestars_get_template_page_id('blog-services')==get_the_ID());
}
}
// Filter to detect current page inheritance key
if ( !function_exists( 'fivestars_services_detect_inheritance_key' ) ) {
//add_filter('fivestars_filter_detect_inheritance_key', 'fivestars_services_detect_inheritance_key', 9, 1);
function fivestars_services_detect_inheritance_key($key) {
if (!empty($key)) return $key;
return fivestars_is_services_page() ? 'services' : '';
}
}
// Filter to detect current page slug
if ( !function_exists( 'fivestars_services_get_blog_type' ) ) {
//add_filter('fivestars_filter_get_blog_type', 'fivestars_services_get_blog_type', 9, 2);
function fivestars_services_get_blog_type($page, $query=null) {
if (!empty($page)) return $page;
if ($query && $query->is_tax('services_group') || is_tax('services_group'))
$page = 'services_category';
else if ($query && $query->get('post_type')=='services' || get_query_var('post_type')=='services')
$page = $query && $query->is_single() || is_single() ? 'services_item' : 'services';
return $page;
}
}
// Filter to detect current page title
if ( !function_exists( 'fivestars_services_get_blog_title' ) ) {
//add_filter('fivestars_filter_get_blog_title', 'fivestars_services_get_blog_title', 9, 2);
function fivestars_services_get_blog_title($title, $page) {
if (!empty($title)) return $title;
if ( fivestars_strpos($page, 'services')!==false ) {
if ( $page == 'services_category' ) {
$term = get_term_by( 'slug', get_query_var( 'services_group' ), 'services_group', OBJECT);
$title = $term->name;
} else if ( $page == 'services_item' ) {
$title = fivestars_get_post_title();
} else {
$title = esc_html__('All services', 'fivestars');
}
}
return $title;
}
}
// Filter to detect stream page title
if ( !function_exists( 'fivestars_services_get_stream_page_title' ) ) {
//add_filter('fivestars_filter_get_stream_page_title', 'fivestars_services_get_stream_page_title', 9, 2);
function fivestars_services_get_stream_page_title($title, $page) {
if (!empty($title)) return $title;
if (fivestars_strpos($page, 'services')!==false) {
if (($page_id = fivestars_services_get_stream_page_id(0, $page=='services' ? 'blog-services' : $page)) > 0)
$title = fivestars_get_post_title($page_id);
else
$title = esc_html__('All services', 'fivestars');
}
return $title;
}
}
// Filter to detect stream page ID
if ( !function_exists( 'fivestars_services_get_stream_page_id' ) ) {
//add_filter('fivestars_filter_get_stream_page_id', 'fivestars_services_get_stream_page_id', 9, 2);
function fivestars_services_get_stream_page_id($id, $page) {
if (!empty($id)) return $id;
if (fivestars_strpos($page, 'services')!==false) $id = fivestars_get_template_page_id('blog-services');
return $id;
}
}
// Filter to detect stream page URL
if ( !function_exists( 'fivestars_services_get_stream_page_link' ) ) {
//add_filter('fivestars_filter_get_stream_page_link', 'fivestars_services_get_stream_page_link', 9, 2);
function fivestars_services_get_stream_page_link($url, $page) {
if (!empty($url)) return $url;
if (fivestars_strpos($page, 'services')!==false) {
$id = fivestars_get_template_page_id('blog-services');
if ($id) $url = get_permalink($id);
}
return $url;
}
}
// Filter to detect current taxonomy
if ( !function_exists( 'fivestars_services_get_current_taxonomy' ) ) {
//add_filter('fivestars_filter_get_current_taxonomy', 'fivestars_services_get_current_taxonomy', 9, 2);
function fivestars_services_get_current_taxonomy($tax, $page) {
if (!empty($tax)) return $tax;
if ( fivestars_strpos($page, 'services')!==false ) {
$tax = 'services_group';
}
return $tax;
}
}
// Return taxonomy name (slug) if current page is this taxonomy page
if ( !function_exists( 'fivestars_services_is_taxonomy' ) ) {
//add_filter('fivestars_filter_is_taxonomy', 'fivestars_services_is_taxonomy', 9, 2);
function fivestars_services_is_taxonomy($tax, $query=null) {
if (!empty($tax))
return $tax;
else
return $query && $query->get('services_group')!='' || is_tax('services_group') ? 'services_group' : '';
}
}
// Add custom post type and/or taxonomies arguments to the query
if ( !function_exists( 'fivestars_services_query_add_filters' ) ) {
//add_filter('fivestars_filter_query_add_filters', 'fivestars_services_query_add_filters', 9, 2);
function fivestars_services_query_add_filters($args, $filter) {
if ($filter == 'services') {
$args['post_type'] = 'services';
}
return $args;
}
}
// ---------------------------------- [trx_services] ---------------------------------------
/*
[trx_services id="unique_id" columns="4" count="4" style="services-1|services-2|..." title="Block title" subtitle="xxx" description="xxxxxx"]
[trx_services_item icon="url" title="Item title" description="Item description" link="url" link_caption="Link text"]
[trx_services_item icon="url" title="Item title" description="Item description" link="url" link_caption="Link text"]
[/trx_services]
*/
if ( !function_exists( 'fivestars_sc_services' ) ) {
//fivestars_require_shortcode('trx_services', 'fivestars_sc_services');
function fivestars_sc_services($atts, $content=null){
if (fivestars_in_shortcode_blogger()) return '';
extract(fivestars_html_decode(shortcode_atts(array(
// Individual params
"style" => "services-5",
"columns" => 4,
"slider" => "no",
"controls" => "no",
"interval" => "",
"autoheight" => "no",
"align" => "",
"custom" => "no",
"type" => "icons", // icons | images
"ids" => "",
"cat" => "",
"count" => 4,
"offset" => "",
"orderby" => "date",
"order" => "desc",
"readmore" => esc_html__('Learn more', 'fivestars'),
"title" => "",
"subtitle" => "",
"description" => "",
"link_caption" => esc_html__('Learn more', 'fivestars'),
"link" => '',
// Common params
"id" => "",
"class" => "",
"animation" => "",
"css" => "",
"width" => "",
"height" => "",
"top" => "",
"bottom" => "",
"left" => "",
"right" => ""
), $atts)));
if (empty($id)) $id = "sc_services_".str_replace('.', '', mt_rand());
if (empty($width)) $width = "100%";
if (!empty($height) && fivestars_param_is_on($autoheight)) $autoheight = "no";
if (empty($interval)) $interval = mt_rand(5000, 10000);
$ms = fivestars_get_css_position_from_values($top, $right, $bottom, $left);
$ws = fivestars_get_css_position_from_values('', '', '', '', $width);
$hs = fivestars_get_css_position_from_values('', '', '', '', '', $height);
$css .= ($ms) . ($hs) . ($ws);
$count = max(1, (int) $count);
$columns = max(1, min(12, (int) $columns));
if (fivestars_param_is_off($custom) && $count < $columns) $columns = $count;
global $FIVESTARS_GLOBALS;
$FIVESTARS_GLOBALS['sc_services_id'] = $id;
$FIVESTARS_GLOBALS['sc_services_style'] = $style;
$FIVESTARS_GLOBALS['sc_services_columns'] = $columns;
$FIVESTARS_GLOBALS['sc_services_counter'] = 0;
$FIVESTARS_GLOBALS['sc_services_slider'] = $slider;
$FIVESTARS_GLOBALS['sc_services_css_wh'] = $ws . $hs;
$FIVESTARS_GLOBALS['sc_services_readmore'] = $readmore;
$output = '
0 ? ' data-interval="'.esc_attr($interval).'"' : '')
. ($columns > 1 ? ' data-slides-per-view="' . esc_attr($columns) . '"' : '')
. (!fivestars_param_is_off($animation) ? ' data-animation="'.esc_attr(fivestars_get_animation_classes($animation)).'"' : '')
. '>'
. (!empty($subtitle) ? '
' . trim(fivestars_strmacros($subtitle)) . ' ' : '')
. (!empty($title) ? '
' . trim(fivestars_strmacros($title)) . ' ' : '')
. (!empty($description) ? '
' . trim(fivestars_strmacros($description)) . '
' : '')
. (fivestars_param_is_on($slider)
? '
'
: ($columns > 1
? '
'
: '')
);
$content = do_shortcode($content);
if (fivestars_param_is_on($custom) && $content) {
$output .= $content;
} else {
global $post;
if (!empty($ids)) {
$posts = explode(',', $ids);
$count = count($posts);
}
$args = array(
'post_type' => 'services',
'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 = fivestars_query_add_sort_order($args, $orderby, $order);
$args = fivestars_query_add_posts_and_cats($args, $ids, 'services', $cat, 'services_group');
$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" => fivestars_get_custom_option('post_excerpt_maxlength'.($columns > 1 ? '_masonry' : '')),
"orderby" => $orderby,
'content' => false,
'terms_list' => false,
'readmore' => $readmore,
'tag_type' => $type,
'columns_count' => $columns,
'slider' => $slider,
'tag_id' => $id ? $id . '_' . $post_number : '',
'tag_class' => '',
'tag_animation' => '',
'tag_css' => '',
'tag_css_wh' => $ws . $hs
);
$output .= fivestars_show_post_layout($args);
}
wp_reset_postdata();
}
if (fivestars_param_is_on($slider)) {
$output .= '
'
. '
'
. '';
} else if ($columns > 1) {
$output .= '
';
}
$output .= (!empty($link) ? '
'.do_shortcode('[trx_button link="'.esc_url($link).'" icon="icon-right"]'.esc_html($link_caption).'[/trx_button]').'
' : '')
. '
';
return apply_filters('fivestars_shortcode_output', $output, 'trx_services', $atts, $content);
}
if (function_exists('fivestars_require_shortcode')) fivestars_require_shortcode('trx_services', 'fivestars_sc_services');
}
//fivestars_require_shortcode('trx_services_item', 'fivestars_sc_services_item');
if ( !function_exists( 'fivestars_sc_services_item' ) ) {
function fivestars_sc_services_item($atts, $content=null) {
if (fivestars_in_shortcode_blogger()) return '';
extract(fivestars_html_decode(shortcode_atts( array(
// Individual params
"icon" => "",
"image" => "",
"title" => "",
"link" => "",
"readmore" => "(none)",
// Common params
"id" => "",
"class" => "",
"animation" => "",
"css" => ""
), $atts)));
global $FIVESTARS_GLOBALS;
$FIVESTARS_GLOBALS['sc_services_counter']++;
$id = $id ? $id : ($FIVESTARS_GLOBALS['sc_services_id'] ? $FIVESTARS_GLOBALS['sc_services_id'] . '_' . $FIVESTARS_GLOBALS['sc_services_counter'] : '');
$descr = trim(chop(do_shortcode($content)));
$readmore = $readmore=='(none)' ? $FIVESTARS_GLOBALS['sc_services_readmore'] : $readmore;
$type = '';
if (!empty($icon)) {
$type = 'icons';
} else if (!empty($image)) {
$type = 'images';
if ($image > 0) {
$attach = wp_get_attachment_image_src( $image, 'full' );
if (isset($attach[0]) && $attach[0]!='')
$image = $attach[0];
}
$thumb_sizes = fivestars_get_thumb_sizes(array('layout' => $FIVESTARS_GLOBALS['sc_services_style']));
$image = fivestars_get_resized_image_tag($image, $thumb_sizes['w'], $thumb_sizes['h']);
}
$post_data = array(
'post_title' => $title,
'post_excerpt' => $descr,
'post_thumb' => $image,
'post_icon' => $icon,
'post_link' => $link
);
$args = array(
'layout' => $FIVESTARS_GLOBALS['sc_services_style'],
'number' => $FIVESTARS_GLOBALS['sc_services_counter'],
'columns_count' => $FIVESTARS_GLOBALS['sc_services_columns'],
'slider' => $FIVESTARS_GLOBALS['sc_services_slider'],
'show' => false,
'descr' => 0,
'readmore' => $readmore,
'tag_type' => $type,
'tag_id' => $id,
'tag_class' => $class,
'tag_animation' => $animation,
'tag_css' => $css,
'tag_css_wh' => $FIVESTARS_GLOBALS['sc_services_css_wh']
);
$output = fivestars_show_post_layout($args, $post_data);
return apply_filters('fivestars_shortcode_output', $output, 'trx_services_item', $atts, $content);
}
if (function_exists('fivestars_require_shortcode')) fivestars_require_shortcode('trx_services_item', 'fivestars_sc_services_item');
}
// ---------------------------------- [/trx_services] ---------------------------------------
// Add [trx_services] and [trx_services_item] in the shortcodes list
if (!function_exists('fivestars_services_add_shortcodes')) {
//add_filter('fivestars_action_shortcodes_list', 'fivestars_services_add_shortcodes');
function fivestars_services_add_shortcodes() {
global $FIVESTARS_GLOBALS;
if (isset($FIVESTARS_GLOBALS['shortcodes'])) {
$services_groups = fivestars_get_list_terms(false, 'services_group');
$services_styles = fivestars_get_list_templates('services');
$controls = fivestars_get_list_slider_controls();
fivestars_array_insert_after($FIVESTARS_GLOBALS['shortcodes'], 'trx_section', array(
// Services
"trx_services" => array(
"title" => esc_html__("Services", "fivestars"),
"desc" => esc_html__("Insert services list in your page (post)", "fivestars"),
"decorate" => true,
"container" => false,
"params" => array(
"title" => array(
"title" => esc_html__("Title", "fivestars"),
"desc" => esc_html__("Title for the block", "fivestars"),
"value" => "",
"type" => "text"
),
"subtitle" => array(
"title" => esc_html__("Subtitle", "fivestars"),
"desc" => esc_html__("Subtitle for the block", "fivestars"),
"value" => "",
"type" => "text"
),
"description" => array(
"title" => esc_html__("Description", "fivestars"),
"desc" => esc_html__("Short description for the block", "fivestars"),
"value" => "",
"type" => "textarea"
),
"style" => array(
"title" => esc_html__("Services style", "fivestars"),
"desc" => esc_html__("Select style to display services list", "fivestars"),
"value" => "",
"type" => "select",
"options" => $services_styles
),
"type" => array(
"title" => esc_html__("Icon's type", "fivestars"),
"desc" => esc_html__("Select type of icons: font icon or image", "fivestars"),
"value" => "icons",
"type" => "checklist",
"dir" => "horizontal",
"options" => array(
'icons' => esc_html__('Icons', 'fivestars'),
'images' => esc_html__('Images', 'fivestars')
)
),
"columns" => array(
"title" => esc_html__("Columns", "fivestars"),
"desc" => esc_html__("How many columns use to show services list", "fivestars"),
"value" => 4,
"min" => 2,
"max" => 6,
"step" => 1,
"type" => "spinner"
),
"slider" => array(
"title" => esc_html__("Slider", "fivestars"),
"desc" => esc_html__("Use slider to show services", "fivestars"),
"value" => "no",
"type" => "switch",
"options" => $FIVESTARS_GLOBALS['sc_params']['yes_no']
),
"controls" => array(
"title" => esc_html__("Controls", "fivestars"),
"desc" => esc_html__("Slider controls style and position", "fivestars"),
"dependency" => array(
'slider' => array('yes')
),
"divider" => true,
"value" => "",
"type" => "checklist",
"dir" => "horizontal",
"options" => $controls
),
"interval" => array(
"title" => esc_html__("Slides change interval", "fivestars"),
"desc" => esc_html__("Slides change interval (in milliseconds: 1000ms = 1s)", "fivestars"),
"dependency" => array(
'slider' => array('yes')
),
"value" => 7000,
"step" => 500,
"min" => 0,
"type" => "spinner"
),
"autoheight" => array(
"title" => esc_html__("Autoheight", "fivestars"),
"desc" => esc_html__("Change whole slider's height (make it equal current slide's height)", "fivestars"),
"dependency" => array(
'slider' => array('yes')
),
"value" => "yes",
"type" => "switch",
"options" => $FIVESTARS_GLOBALS['sc_params']['yes_no']
),
"align" => array(
"title" => esc_html__("Alignment", "fivestars"),
"desc" => esc_html__("Alignment of the services block", "fivestars"),
"divider" => true,
"value" => "",
"type" => "checklist",
"dir" => "horizontal",
"options" => $FIVESTARS_GLOBALS['sc_params']['align']
),
"custom" => array(
"title" => esc_html__("Custom", "fivestars"),
"desc" => esc_html__("Allow get services items from inner shortcodes (custom) or get it from specified group (cat)", "fivestars"),
"divider" => true,
"value" => "no",
"type" => "switch",
"options" => $FIVESTARS_GLOBALS['sc_params']['yes_no']
),
"cat" => array(
"title" => esc_html__("Categories", "fivestars"),
"desc" => esc_html__("Select categories (groups) to show services list. If empty - select services from any category (group) or from IDs list", "fivestars"),
"dependency" => array(
'custom' => array('no')
),
"divider" => true,
"value" => "",
"type" => "select",
"style" => "list",
"multiple" => true,
"options" => fivestars_array_merge(array(0 => esc_html__('- Select category -', 'fivestars')), $services_groups)
),
"count" => array(
"title" => esc_html__("Number of posts", "fivestars"),
"desc" => esc_html__("How many posts will be displayed? If used IDs - this parameter ignored.", "fivestars"),
"dependency" => array(
'custom' => array('no')
),
"value" => 3,
"min" => 1,
"max" => 100,
"type" => "spinner"
),
"offset" => array(
"title" => esc_html__("Offset before select posts", "fivestars"),
"desc" => esc_html__("Skip posts before select next part.", "fivestars"),
"dependency" => array(
'custom' => array('no')
),
"value" => 0,
"min" => 0,
"type" => "spinner"
),
"orderby" => array(
"title" => esc_html__("Post order by", "fivestars"),
"desc" => esc_html__("Select desired posts sorting method", "fivestars"),
"dependency" => array(
'custom' => array('no')
),
"value" => "title",
"type" => "select",
"options" => $FIVESTARS_GLOBALS['sc_params']['sorting']
),
"order" => array(
"title" => esc_html__("Post order", "fivestars"),
"desc" => esc_html__("Select desired posts order", "fivestars"),
"dependency" => array(
'custom' => array('no')
),
"value" => "asc",
"type" => "switch",
"size" => "big",
"options" => $FIVESTARS_GLOBALS['sc_params']['ordering']
),
"ids" => array(
"title" => esc_html__("Post IDs list", "fivestars"),
"desc" => esc_html__("Comma separated list of posts ID. If set - parameters above are ignored!", "fivestars"),
"dependency" => array(
'custom' => array('no')
),
"value" => "",
"type" => "text"
),
"readmore" => array(
"title" => esc_html__("Read more", "fivestars"),
"desc" => esc_html__("Caption for the Read more link (if empty - link not showed)", "fivestars"),
"value" => "",
"type" => "text"
),
"link" => array(
"title" => esc_html__("Button URL", "fivestars"),
"desc" => esc_html__("Link URL for the button at the bottom of the block", "fivestars"),
"value" => "",
"type" => "text"
),
"link_caption" => array(
"title" => esc_html__("Button caption", "fivestars"),
"desc" => esc_html__("Caption for the button at the bottom of the block", "fivestars"),
"value" => "",
"type" => "text"
),
"width" => fivestars_shortcodes_width(),
"height" => fivestars_shortcodes_height(),
"top" => $FIVESTARS_GLOBALS['sc_params']['top'],
"bottom" => $FIVESTARS_GLOBALS['sc_params']['bottom'],
"left" => $FIVESTARS_GLOBALS['sc_params']['left'],
"right" => $FIVESTARS_GLOBALS['sc_params']['right'],
"id" => $FIVESTARS_GLOBALS['sc_params']['id'],
"class" => $FIVESTARS_GLOBALS['sc_params']['class'],
"animation" => $FIVESTARS_GLOBALS['sc_params']['animation'],
"css" => $FIVESTARS_GLOBALS['sc_params']['css']
),
"children" => array(
"name" => "trx_services_item",
"title" => esc_html__("Service item", "fivestars"),
"desc" => esc_html__("Service item", "fivestars"),
"container" => true,
"params" => array(
"title" => array(
"title" => esc_html__("Title", "fivestars"),
"desc" => esc_html__("Item's title", "fivestars"),
"divider" => true,
"value" => "",
"type" => "text"
),
"icon" => array(
"title" => esc_html__("Item's icon", 'fivestars'),
"desc" => esc_html__('Select icon for the item from Fontello icons set', 'fivestars'),
"value" => "",
"type" => "icons",
"options" => $FIVESTARS_GLOBALS['sc_params']['icons']
),
"image" => array(
"title" => esc_html__("Item's image", "fivestars"),
"desc" => esc_html__("Item's image (if icon not selected)", "fivestars"),
"dependency" => array(
'icon' => array('is_empty', 'none')
),
"value" => "",
"readonly" => false,
"type" => "media"
),
"link" => array(
"title" => esc_html__("Link", "fivestars"),
"desc" => esc_html__("Link on service's item page", "fivestars"),
"divider" => true,
"value" => "",
"type" => "text"
),
"readmore" => array(
"title" => esc_html__("Read more", "fivestars"),
"desc" => esc_html__("Caption for the Read more link (if empty - link not showed)", "fivestars"),
"value" => "",
"type" => "text"
),
"_content_" => array(
"title" => esc_html__("Description", "fivestars"),
"desc" => esc_html__("Item's short description", "fivestars"),
"divider" => true,
"rows" => 4,
"value" => "",
"type" => "textarea"
),
"id" => $FIVESTARS_GLOBALS['sc_params']['id'],
"class" => $FIVESTARS_GLOBALS['sc_params']['class'],
"animation" => $FIVESTARS_GLOBALS['sc_params']['animation'],
"css" => $FIVESTARS_GLOBALS['sc_params']['css']
)
)
)
));
}
}
}
// Add [trx_services] and [trx_services_item] in the VC shortcodes list
if (!function_exists('fivestars_services_add_shortcodes_vc')) {
//add_filter('fivestars_action_shortcodes_list_vc', 'fivestars_services_add_shortcodes_vc');
function fivestars_services_add_shortcodes_vc() {
global $FIVESTARS_GLOBALS;
$services_groups = fivestars_get_list_terms(false, 'services_group');
$services_styles = fivestars_get_list_templates('services');
$controls = fivestars_get_list_slider_controls();
// Services
vc_map( array(
"base" => "trx_services",
"name" => esc_html__("Services", "fivestars"),
"description" => esc_html__("Insert services list", "fivestars"),
"category" => esc_html__('Content', 'js_composer'),
"icon" => 'icon_trx_services',
"class" => "trx_sc_columns trx_sc_services",
"content_element" => true,
"is_container" => true,
"show_settings_on_create" => true,
"as_parent" => array('only' => 'trx_services_item'),
"params" => array(
array(
"param_name" => "style",
"heading" => esc_html__("Services style", "fivestars"),
"description" => esc_html__("Select style to display services list", "fivestars"),
"class" => "",
"admin_label" => true,
"std" => "",
"value" => array_flip($services_styles),
"type" => "dropdown"
),
array(
"param_name" => "type",
"heading" => esc_html__("Icon's type", "fivestars"),
"description" => esc_html__("Select type of icons: font icon or image", "fivestars"),
"class" => "",
"admin_label" => true,
"value" => array(
esc_html__('Icons', 'fivestars') => 'icons',
esc_html__('Images', 'fivestars') => 'images'
),
"type" => "dropdown"
),
array(
"param_name" => "columns",
"heading" => esc_html__("Columns", "fivestars"),
"description" => esc_html__("How many columns use to show services list", "fivestars"),
"admin_label" => true,
"class" => "",
"value" => "4",
"type" => "textfield"
),
array(
"param_name" => "slider",
"heading" => esc_html__("Slider", "fivestars"),
"description" => esc_html__("Use slider to show services", "fivestars"),
"admin_label" => true,
"group" => esc_html__('Slider', 'fivestars'),
"class" => "",
"std" => "no",
"value" => array_flip($FIVESTARS_GLOBALS['sc_params']['yes_no']),
"type" => "dropdown"
),
array(
"param_name" => "controls",
"heading" => esc_html__("Controls", "fivestars"),
"description" => esc_html__("Slider controls style and position", "fivestars"),
"admin_label" => true,
"group" => esc_html__('Slider', 'fivestars'),
'dependency' => array(
'element' => 'slider',
'value' => 'yes'
),
"class" => "",
"std" => "no",
"value" => array_flip($controls),
"type" => "dropdown"
),
array(
"param_name" => "interval",
"heading" => esc_html__("Slides change interval", "fivestars"),
"description" => esc_html__("Slides change interval (in milliseconds: 1000ms = 1s)", "fivestars"),
"group" => esc_html__('Slider', 'fivestars'),
'dependency' => array(
'element' => 'slider',
'value' => 'yes'
),
"class" => "",
"value" => "7000",
"type" => "textfield"
),
array(
"param_name" => "autoheight",
"heading" => esc_html__("Autoheight", "fivestars"),
"description" => esc_html__("Change whole slider's height (make it equal current slide's height)", "fivestars"),
"group" => esc_html__('Slider', 'fivestars'),
'dependency' => array(
'element' => 'slider',
'value' => 'yes'
),
"class" => "",
"value" => array("Autoheight" => "yes" ),
"type" => "checkbox"
),
array(
"param_name" => "align",
"heading" => esc_html__("Alignment", "fivestars"),
"description" => esc_html__("Alignment of the services block", "fivestars"),
"class" => "",
"value" => array_flip($FIVESTARS_GLOBALS['sc_params']['align']),
"type" => "dropdown"
),
array(
"param_name" => "custom",
"heading" => esc_html__("Custom", "fivestars"),
"description" => esc_html__("Allow get services from inner shortcodes (custom) or get it from specified group (cat)", "fivestars"),
"class" => "",
"value" => array("Custom services" => "yes" ),
"type" => "checkbox"
),
array(
"param_name" => "title",
"heading" => esc_html__("Title", "fivestars"),
"description" => esc_html__("Title for the block", "fivestars"),
"admin_label" => true,
"group" => esc_html__('Captions', 'fivestars'),
"class" => "",
"value" => "",
"type" => "textfield"
),
array(
"param_name" => "subtitle",
"heading" => esc_html__("Subtitle", "fivestars"),
"description" => esc_html__("Subtitle for the block", "fivestars"),
"group" => esc_html__('Captions', 'fivestars'),
"class" => "",
"value" => "",
"type" => "textfield"
),
array(
"param_name" => "description",
"heading" => esc_html__("Description", "fivestars"),
"description" => esc_html__("Description for the block", "fivestars"),
"group" => esc_html__('Captions', 'fivestars'),
"class" => "",
"value" => "",
"type" => "textarea"
),
array(
"param_name" => "cat",
"heading" => esc_html__("Categories", "fivestars"),
"description" => esc_html__("Select category to show services. If empty - select services from any category (group) or from IDs list", "fivestars"),
"group" => esc_html__('Query', 'fivestars'),
'dependency' => array(
'element' => 'custom',
'is_empty' => true
),
"class" => "",
"value" => array_flip(fivestars_array_merge(array(0 => esc_html__('- Select category -', 'fivestars')), $services_groups)),
"type" => "dropdown"
),
array(
"param_name" => "count",
"heading" => esc_html__("Number of posts", "fivestars"),
"description" => esc_html__("How many posts will be displayed? If used IDs - this parameter ignored.", "fivestars"),
"admin_label" => true,
"group" => esc_html__('Query', 'fivestars'),
'dependency' => array(
'element' => 'custom',
'is_empty' => true
),
"class" => "",
"value" => "3",
"type" => "textfield"
),
array(
"param_name" => "offset",
"heading" => esc_html__("Offset before select posts", "fivestars"),
"description" => esc_html__("Skip posts before select next part.", "fivestars"),
"group" => esc_html__('Query', 'fivestars'),
'dependency' => array(
'element' => 'custom',
'is_empty' => true
),
"class" => "",
"value" => "0",
"type" => "textfield"
),
array(
"param_name" => "orderby",
"heading" => esc_html__("Post sorting", "fivestars"),
"description" => esc_html__("Select desired posts sorting method", "fivestars"),
"group" => esc_html__('Query', 'fivestars'),
'dependency' => array(
'element' => 'custom',
'is_empty' => true
),
"class" => "",
"value" => array_flip($FIVESTARS_GLOBALS['sc_params']['sorting']),
"type" => "dropdown"
),
array(
"param_name" => "order",
"heading" => esc_html__("Post order", "fivestars"),
"description" => esc_html__("Select desired posts order", "fivestars"),
"group" => esc_html__('Query', 'fivestars'),
'dependency' => array(
'element' => 'custom',
'is_empty' => true
),
"class" => "",
"value" => array_flip($FIVESTARS_GLOBALS['sc_params']['ordering']),
"type" => "dropdown"
),
array(
"param_name" => "ids",
"heading" => esc_html__("Team member's IDs list", "fivestars"),
"description" => esc_html__("Comma separated list of team members's ID. If set - parameters above (category, count, order, etc.) are ignored!", "fivestars"),
"group" => esc_html__('Query', 'fivestars'),
'dependency' => array(
'element' => 'custom',
'is_empty' => true
),
"class" => "",
"value" => "",
"type" => "textfield"
),
array(
"param_name" => "readmore",
"heading" => esc_html__("Read more", "fivestars"),
"description" => esc_html__("Caption for the Read more link (if empty - link not showed)", "fivestars"),
"admin_label" => true,
"group" => esc_html__('Captions', 'fivestars'),
"class" => "",
"value" => "",
"type" => "textfield"
),
array(
"param_name" => "link",
"heading" => esc_html__("Button URL", "fivestars"),
"description" => esc_html__("Link URL for the button at the bottom of the block", "fivestars"),
"group" => esc_html__('Captions', 'fivestars'),
"class" => "",
"value" => "",
"type" => "textfield"
),
array(
"param_name" => "link_caption",
"heading" => esc_html__("Button caption", "fivestars"),
"description" => esc_html__("Caption for the button at the bottom of the block", "fivestars"),
"group" => esc_html__('Captions', 'fivestars'),
"class" => "",
"value" => "",
"type" => "textfield"
),
fivestars_vc_width(),
fivestars_vc_height(),
$FIVESTARS_GLOBALS['vc_params']['margin_top'],
$FIVESTARS_GLOBALS['vc_params']['margin_bottom'],
$FIVESTARS_GLOBALS['vc_params']['margin_left'],
$FIVESTARS_GLOBALS['vc_params']['margin_right'],
$FIVESTARS_GLOBALS['vc_params']['id'],
$FIVESTARS_GLOBALS['vc_params']['class'],
$FIVESTARS_GLOBALS['vc_params']['animation'],
$FIVESTARS_GLOBALS['vc_params']['css']
),
'default_content' => '
[trx_services_item title="' . esc_html__( 'Service item 1', 'fivestars' ) . '"][/trx_services_item]
[trx_services_item title="' . esc_html__( 'Service item 2', 'fivestars' ) . '"][/trx_services_item]
[trx_services_item title="' . esc_html__( 'Service item 3', 'fivestars' ) . '"][/trx_services_item]
[trx_services_item title="' . esc_html__( 'Service item 4', 'fivestars' ) . '"][/trx_services_item]
',
'js_view' => 'VcTrxColumnsView'
) );
vc_map( array(
"base" => "trx_services_item",
"name" => esc_html__("Services item", "fivestars"),
"description" => esc_html__("Custom services item - all data pull out from shortcode parameters", "fivestars"),
"show_settings_on_create" => true,
"class" => "trx_sc_collection trx_sc_column_item trx_sc_services_item",
"content_element" => true,
"is_container" => true,
'icon' => 'icon_trx_services_item',
"as_child" => array('only' => 'trx_services'),
"as_parent" => array('except' => 'trx_services'),
"params" => array(
array(
"param_name" => "title",
"heading" => esc_html__("Title", "fivestars"),
"description" => esc_html__("Item's title", "fivestars"),
"admin_label" => true,
"class" => "",
"value" => "",
"type" => "textfield"
),
array(
"param_name" => "icon",
"heading" => esc_html__("Icon", "fivestars"),
"description" => esc_html__("Select icon for the item from Fontello icons set", "fivestars"),
"class" => "",
"value" => $FIVESTARS_GLOBALS['sc_params']['icons'],
"type" => "dropdown"
),
array(
"param_name" => "image",
"heading" => esc_html__("Image", "fivestars"),
"description" => esc_html__("Item's image (if icon is empty)", "fivestars"),
"class" => "",
"value" => "",
"type" => "attach_image"
),
array(
"param_name" => "link",
"heading" => esc_html__("Link", "fivestars"),
"description" => esc_html__("Link on item's page", "fivestars"),
"class" => "",
"value" => "",
"type" => "textfield"
),
array(
"param_name" => "readmore",
"heading" => esc_html__("Read more", "fivestars"),
"description" => esc_html__("Caption for the Read more link (if empty - link not showed)", "fivestars"),
"class" => "",
"value" => "",
"type" => "textfield"
),
$FIVESTARS_GLOBALS['vc_params']['id'],
$FIVESTARS_GLOBALS['vc_params']['class'],
$FIVESTARS_GLOBALS['vc_params']['animation'],
$FIVESTARS_GLOBALS['vc_params']['css']
),
'js_view' => 'VcTrxColumnItemView'
) );
class WPBakeryShortCode_Trx_Services extends FIVESTARS_VC_ShortCodeColumns {}
class WPBakeryShortCode_Trx_Services_Item extends FIVESTARS_VC_ShortCodeCollection {}
}
}
?>
/* Tribe Events (TE) support functions
------------------------------------------------------------------------------- */
// Theme init
if (!function_exists('fivestars_tribe_events_theme_setup')) {
add_action( 'fivestars_action_before_init_theme', 'fivestars_tribe_events_theme_setup' );
function fivestars_tribe_events_theme_setup() {
if (fivestars_exists_tribe_events()) {
//if (fivestars_is_tribe_events_page()) {
// 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('fivestars_filter_get_blog_type', 'fivestars_tribe_events_get_blog_type', 9, 2);
add_filter('fivestars_filter_get_blog_title', 'fivestars_tribe_events_get_blog_title', 9, 2);
add_filter('fivestars_filter_get_current_taxonomy', 'fivestars_tribe_events_get_current_taxonomy', 9, 2);
add_filter('fivestars_filter_is_taxonomy', 'fivestars_tribe_events_is_taxonomy', 9, 2);
add_filter('fivestars_filter_get_stream_page_title', 'fivestars_tribe_events_get_stream_page_title', 9, 2);
add_filter('fivestars_filter_get_stream_page_link', 'fivestars_tribe_events_get_stream_page_link', 9, 2);
add_filter('fivestars_filter_get_stream_page_id', 'fivestars_tribe_events_get_stream_page_id', 9, 2);
add_filter('fivestars_filter_get_period_links', 'fivestars_tribe_events_get_period_links', 9, 3);
add_filter('fivestars_filter_detect_inheritance_key', 'fivestars_tribe_events_detect_inheritance_key', 9, 1);
//}
add_action( 'fivestars_action_add_styles', 'fivestars_tribe_events_frontend_scripts' );
add_filter('fivestars_filter_list_post_types', 'fivestars_tribe_events_list_post_types', 10, 1);
// Advanced Calendar filters
add_filter('fivestars_filter_calendar_get_month_link', 'fivestars_tribe_events_calendar_get_month_link', 9, 2);
add_filter('fivestars_filter_calendar_get_prev_month', 'fivestars_tribe_events_calendar_get_prev_month', 9, 2);
add_filter('fivestars_filter_calendar_get_next_month', 'fivestars_tribe_events_calendar_get_next_month', 9, 2);
add_filter('fivestars_filter_calendar_get_curr_month_posts', 'fivestars_tribe_events_calendar_get_curr_month_posts', 9, 2);
// Extra column for events lists
if (fivestars_get_theme_option('show_overriden_posts')=='yes') {
add_filter('manage_edit-'.Tribe__Events__Main::POSTTYPE.'_columns', 'fivestars_post_add_options_column', 9);
add_filter('manage_'.Tribe__Events__Main::POSTTYPE.'_posts_custom_column', 'fivestars_post_fill_options_column', 9, 2);
}
}
}
}
if ( !function_exists( 'fivestars_tribe_events_settings_theme_setup2' ) ) {
add_action( 'fivestars_action_before_init_theme', 'fivestars_tribe_events_settings_theme_setup2', 3 );
function fivestars_tribe_events_settings_theme_setup2() {
if (fivestars_exists_tribe_events()) {
fivestars_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'
) )
);
}
}
}
// Check if Tribe Events installed and activated
if (!function_exists('fivestars_exists_tribe_events')) {
function fivestars_exists_tribe_events() {
return class_exists( 'Tribe__Events__Main' );
}
}
// Return true, if current page is any TE page
if ( !function_exists( 'fivestars_is_tribe_events_page' ) ) {
function fivestars_is_tribe_events_page() {
return !is_search() && class_exists('Tribe__Events__Main')
? tribe_is_event() || tribe_is_event_query() || tribe_is_event_category() || tribe_is_event_venue() || tribe_is_event_organizer()
: false;
}
}
// Filter to detect current page inheritance key
if ( !function_exists( 'fivestars_tribe_events_detect_inheritance_key' ) ) {
//add_filter('fivestars_filter_detect_inheritance_key', 'fivestars_tribe_events_detect_inheritance_key', 9, 1);
function fivestars_tribe_events_detect_inheritance_key($key) {
if (!empty($key)) return $key;
return fivestars_is_tribe_events_page() ? 'tribe_events' : '';
}
}
// Filter to detect current page slug
if ( !function_exists( 'fivestars_tribe_events_get_blog_type' ) ) {
//add_filter('fivestars_filter_get_blog_type', 'fivestars_tribe_events_get_blog_type', 10, 2);
function fivestars_tribe_events_get_blog_type($page, $query=null) {
if (!empty($page)) return $page;
if (!is_search() && fivestars_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( 'fivestars_tribe_events_get_blog_title' ) ) {
//add_filter('fivestars_filter_get_blog_title', 'fivestars_tribe_events_get_blog_title', 10, 2);
function fivestars_tribe_events_get_blog_title($title, $page) {
if (!empty($title)) return $title;
if ( fivestars_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', 'fivestars' ), single_tag_title( '', false ) );
} else if ( $page == 'tribe_venue' ) {
$title = sprintf( esc_html__( 'Venue: %s', 'fivestars' ), tribe_get_venue());
} else if ( $page == 'tribe_organizer' ) {
$title = sprintf( esc_html__( 'Organizer: %s', 'fivestars' ), tribe_get_organizer());
} else if ( $page == 'tribe_day' ) {
$title = sprintf( esc_html__( 'Daily Events: %s', 'fivestars' ), 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', 'fivestars' ), date_i18n(tribe_get_option('monthAndYearFormat', 'F Y' ), strtotime(tribe_get_month_view_date())));
} else if ( $page == 'tribe_event' ) {
$title = fivestars_get_post_title();
} else {
$title = esc_html__( 'Tribe Events', 'fivestars' );
}
}
return $title;
}
}
// Filter to detect stream page title
if ( !function_exists( 'fivestars_tribe_events_get_stream_page_title' ) ) {
//add_filter('fivestars_filter_get_stream_page_title', 'fivestars_tribe_events_get_stream_page_title', 9, 2);
function fivestars_tribe_events_get_stream_page_title($title, $page) {
if (!empty($title)) return $title;
if (fivestars_strpos($page, 'tribe')!==false) {
if (($page_id = fivestars_tribe_events_get_stream_page_id(0, $page)) > 0)
$title = fivestars_get_post_title($page_id);
else
$title = esc_html__( 'All Events', 'fivestars');
}
return $title;
}
}
// Filter to detect stream page ID
if ( !function_exists( 'fivestars_tribe_events_get_stream_page_id' ) ) {
//add_filter('fivestars_filter_get_stream_page_id', 'fivestars_tribe_events_get_stream_page_id', 9, 2);
function fivestars_tribe_events_get_stream_page_id($id, $page) {
if (!empty($id)) return $id;
if (fivestars_strpos($page, 'tribe')!==false) $id = fivestars_get_template_page_id('tribe-events/default-template');
return $id;
}
}
// Filter to detect stream page URL
if ( !function_exists( 'fivestars_tribe_events_get_stream_page_link' ) ) {
//add_filter('fivestars_filter_get_stream_page_link', 'fivestars_tribe_events_get_stream_page_link', 9, 2);
function fivestars_tribe_events_get_stream_page_link($url, $page) {
if (!empty($url)) return $url;
if (fivestars_strpos($page, 'tribe')!==false) $url = tribe_get_events_link();
return $url;
}
}
// Filter to return breadcrumbs links to the parent period
if ( !function_exists( 'fivestars_tribe_events_get_period_links' ) ) {
//add_filter('fivestars_filter_get_period_links', 'fivestars_tribe_events_get_period_links', 9, 3);
function fivestars_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( 'fivestars_tribe_events_get_current_taxonomy' ) ) {
//add_filter('fivestars_filter_get_current_taxonomy', 'fivestars_tribe_events_get_current_taxonomy', 9, 2);
function fivestars_tribe_events_get_current_taxonomy($tax, $page) {
if (!empty($tax)) return $tax;
if ( fivestars_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( 'fivestars_tribe_events_is_taxonomy' ) ) {
//add_filter('fivestars_filter_is_taxonomy', 'fivestars_tribe_events_is_taxonomy', 10, 2);
function fivestars_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( 'fivestars_tribe_events_list_post_types' ) ) {
//add_filter('fivestars_filter_list_post_types', 'fivestars_tribe_events_list_post_types', 10, 1);
function fivestars_tribe_events_list_post_types($list) {
$list['tribe_events'] = esc_html__('Events', 'fivestars');
return $list;
}
}
// Return previous month and year with published posts
if ( !function_exists( 'fivestars_tribe_events_calendar_get_month_link' ) ) {
//add_filter('fivestars_filter_calendar_get_month_link', 'fivestars_tribe_events_calendar_get_month_link', 9, 2);
function fivestars_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( 'fivestars_tribe_events_calendar_get_prev_month' ) ) {
//add_filter('fivestars_filter_calendar_get_prev_month', 'fivestars_tribe_events_calendar_get_prev_month', 9, 2);
function fivestars_tribe_events_calendar_get_prev_month($prev, $opt) {
if (!empty($opt['posts_types']) && !in_array(Tribe__Events__Main::POSTTYPE, $opt['posts_types'])) return;
if (!empty($prev['done']) && in_array(Tribe__Events__Main::POSTTYPE, $prev['done'])) return;
$args = array(
'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( 'fivestars_tribe_events_calendar_get_next_month' ) ) {
//add_filter('fivestars_filter_calendar_get_next_month', 'fivestars_tribe_events_calendar_get_next_month', 9, 2);
function fivestars_tribe_events_calendar_get_next_month($next, $opt) {
if (!empty($opt['posts_types']) && !in_array(Tribe__Events__Main::POSTTYPE, $opt['posts_types'])) return;
if (!empty($next['done']) && in_array(Tribe__Events__Main::POSTTYPE, $next['done'])) return;
$args = array(
'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( 'fivestars_tribe_events_calendar_get_curr_month_posts' ) ) {
//add_filter('fivestars_filter_calendar_get_curr_month_posts', 'fivestars_tribe_events_calendar_get_curr_month_posts', 9, 2);
function fivestars_tribe_events_calendar_get_curr_month_posts($posts, $opt) {
if (!empty($opt['posts_types']) && !in_array(Tribe__Events__Main::POSTTYPE, $opt['posts_types'])) return;
if (!empty($posts['done']) && in_array(Tribe__Events__Main::POSTTYPE, $posts['done'])) return;
$args = array(
'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( 'fivestars_tribe_events_frontend_scripts' ) ) {
//add_action( 'fivestars_action_add_styles', 'fivestars_tribe_events_frontend_scripts' );
function fivestars_tribe_events_frontend_scripts() {
global $wp_styles;
$wp_styles->done[] = 'tribe-events-custom-jquery-styles';
fivestars_enqueue_style( 'tribe-style', fivestars_get_file_url('css/tribe-style.css'), array(), null );
}
}
// Before main content
if ( !function_exists( 'fivestars_tribe_events_wrapper_start' ) ) {
//add_filter('tribe_events_before_html', 'fivestars_tribe_events_wrapper_start');
function fivestars_tribe_events_wrapper_start($html) {
return '
' . ($html);
}
}
// After main content
if ( !function_exists( 'fivestars_tribe_events_wrapper_end' ) ) {
//add_filter('tribe_events_after_html', 'fivestars_tribe_events_wrapper_end');
function fivestars_tribe_events_wrapper_end($html) {
return $html . '
';
}
}
?>
// Autoload layouts in this folder
$name = pathinfo(__FILE__);
fivestars_autoload_folder( 'templates/'.trim($name['filename']) );
?>
Мистрал – Botargo Suites
Мистрал Start from $520/night
Room Type: Double Max Guests: 4 Bed Type: Double Room Faces: Forest WiFi: Yes Breakfast: Yes Room service: Yes Airport pickup: No
Мистрал
Климатична инсталация
Два телевизора с плосък екран
Безплатен Wi-Fi интернет
Сателитна телевизия
Канапе / спалня
Съдове за готвене
Самостоятелен санитарен възел
Камина
Суит апартаментът „Мистрал“ с площ от 70 кв.м. е разположен на две нива и предлага несравнимо гостоприемство на четирима души. Особената подредба на първото ниво включва облицована с мрамор дневна, камина, практична кухня и самостоятелен санитарен възел. Второто ниво предлага удобствата на просторна спалня и обзаведена с изтънчен вкус баня.
Функционалността и комфортът са били основна грижа при оформянето на интериора на „Ботарго“. Спалнята, разположена на второто ниво предлага на посетителя релаксация и спокойствие, докато дневната на първото ниво посредством своята функционалност и изискан стил, създава всички условия за приятен престой.
{
"necessary": {
"name": "Necessary",
"description": "
Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.
"
},
"functional": {
"name": "Functional",
"description": "
Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.
"
},
"analytics": {
"name": "Analytics",
"description": "
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.
"
},
"performance": {
"name": "Performance",
"description": "
Performance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.
"
},
"advertisement": {
"name": "Advertisement",
"description": "
Advertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.
"
}
}
/*! Select2 4.0.13 | https://github.com/select2/select2/blob/master/LICENSE.md */
!function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;e.define("select2/i18n/tk",[],function(){return{errorLoading:function(){return"Netije ýüklenmedi."},inputTooLong:function(e){return e.input.length-e.maximum+" harp bozuň."},inputTooShort:function(e){return"Ýene-de iň az "+(e.minimum-e.input.length)+" harp ýazyň."},loadingMore:function(){return"Köpräk netije görkezilýär…"},maximumSelected:function(e){return"Diňe "+e.maximum+" sanysyny saýlaň."},noResults:function(){return"Netije tapylmady."},searching:function(){return"Gözlenýär…"},removeAllItems:function(){return"Remove all items"}}}),e.define,e.require}();