Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function flo__autoload($class_name)
- {
- if (substr($class_name, 0, 6) == 'widget') {
- $class_name = str_replace('widget_', '', $class_name);
- if (is_file(get_template_directory() . '/lib/php/widget/' . $class_name . '.php')) {
- include get_template_directory() . '/lib/php/widget/' . $class_name . '.php';
- }
- }
- if (is_file(get_template_directory() . '/lib/php/' . $class_name . '.class.php')) {
- include_once get_template_directory() . '/lib/php/' . $class_name . '.class.php';
- if (is_file(get_template_directory() . '/lib/php/' . $class_name . '.register.php')) {
- include_once get_template_directory() . '/lib/php/' . $class_name . '.register.php';
- }
- }
- }
- spl_autoload_register("flo__autoload");
- /*register tags and categories taxonomies for video posts*/
- $video_categ_permalink = options::get_value('general', 'video_categ_link');
- if (!$video_categ_permalink) {
- $video_categ_permalink = 'video-category';
- }
- $video_tags_permalink = options::get_value('general', 'video_tags_link');
- if (!$video_tags_permalink) {
- $video_tags_permalink = 'video-tag';
- }
- $video_category = array(
- 'hierarchical' => true,
- 'labels' => array(
- 'name' => _x('Video Categories', 'taxonomy general name', 'flotheme'),
- 'singular_name' => _x('Video Category', 'taxonomy singular name', 'flotheme'),
- 'search_items' => __('Search Categories', 'flotheme'),
- 'all_items' => __('All Categories', 'flotheme'),
- 'parent_item' => __('Parent Category', 'flotheme'),
- 'parent_item_colon' => __('Parent Category:', 'flotheme'),
- 'edit_item' => __('Edit Category', 'flotheme'),
- 'update_item' => __('Update Category', 'flotheme'),
- 'add_new_item' => __('Add New Category', 'flotheme'),
- 'new_item_name' => __('New Category Name', 'flotheme'),
- 'menu_name' => __('Categories', 'flotheme'),
- ),
- 'show_ui' => true,
- 'query_var' => true,
- 'rewrite' => array('slug' => $video_categ_permalink),
- );
- $video_tag = array(
- 'hierarchical' => false,
- 'labels' => array(
- 'name' => _x('Video Tags', 'taxonomy general name', 'flotheme'),
- 'singular_name' => _x('Video Tag', 'taxonomy singular name', 'flotheme'),
- 'search_items' => __('Search Tags', 'flotheme'),
- 'popular_items' => __('Popular Tags', 'flotheme'),
- 'all_items' => __('All Tags', 'flotheme'),
- 'parent_item' => NULL,
- 'parent_item_colon' => NULL,
- 'edit_item' => __('Edit Tag', 'flotheme'),
- 'update_item' => __('Update Tag', 'flotheme'),
- 'add_new_item' => __('Add New Tag', 'flotheme'),
- 'new_item_name' => __('New Tag Name', 'flotheme'),
- 'separate_items_with_commas' => __('Separate tags with commas', 'flotheme'),
- 'add_or_remove_items' => __('Add or remove tags', 'flotheme'),
- 'choose_from_most_used' => __('Choose from the most used tags', 'flotheme'),
- 'menu_name' => __('Tags', 'flotheme'),
- ),
- 'show_ui' => true,
- 'update_count_callback' => '_update_post_term_count',
- 'query_var' => true,
- 'rewrite' => array('slug' => $video_tags_permalink),
- );
- register_taxonomy('video-category', 'video', $video_category);
- register_taxonomy('video-tag', 'video', $video_tag);
- /* EOF register tags and categories taxonomies for video posts */
- /*register tags and categories taxonomies for gallery posts*/
- $gallery_categ_permalink = options::get_value('general', 'gallery_categ_link');
- if (!$gallery_categ_permalink) {
- $gallery_categ_permalink = 'gallery-category';
- }
- $gallery_tags_permalink = options::get_value('general', 'gallery_tags_link');
- if (!$gallery_tags_permalink) {
- $gallery_tags_permalink = 'gallery-tag';
- }
- $gallery_category = array(
- 'hierarchical' => true,
- 'labels' => array(
- 'name' => _x('Gallery Categories', 'taxonomy general name', 'flotheme'),
- 'singular_name' => _x('Gallery Category', 'taxonomy singular name', 'flotheme'),
- 'search_items' => __('Search Categories', 'flotheme'),
- 'all_items' => __('All Categories', 'flotheme'),
- 'parent_item' => __('Parent Category', 'flotheme'),
- 'parent_item_colon' => __('Parent Category:', 'flotheme'),
- 'edit_item' => __('Edit Category', 'flotheme'),
- 'update_item' => __('Update Category', 'flotheme'),
- 'add_new_item' => __('Add New Category', 'flotheme'),
- 'new_item_name' => __('New Category Name', 'flotheme'),
- 'menu_name' => __('Categories', 'flotheme'),
- ),
- 'show_ui' => true,
- 'query_var' => true,
- 'rewrite' => array('slug' => $gallery_categ_permalink),
- );
- $gallery_tag = array(
- 'hierarchical' => false,
- 'labels' => array(
- 'name' => _x('Gallery Tags', 'taxonomy general name', 'flotheme'),
- 'singular_name' => _x('Gallery Tag', 'taxonomy singular name', 'flotheme'),
- 'search_items' => __('Search Tags', 'flotheme'),
- 'popular_items' => __('Popular Tags', 'flotheme'),
- 'all_items' => __('All Tags', 'flotheme'),
- 'parent_item' => NULL,
- 'parent_item_colon' => NULL,
- 'edit_item' => __('Edit Tag', 'flotheme'),
- 'update_item' => __('Update Tag', 'flotheme'),
- 'add_new_item' => __('Add New Tag', 'flotheme'),
- 'new_item_name' => __('New Tag Name', 'flotheme'),
- 'separate_items_with_commas' => __('Separate tags with commas', 'flotheme'),
- 'add_or_remove_items' => __('Add or remove tags', 'flotheme'),
- 'choose_from_most_used' => __('Choose from the most used tags', 'flotheme'),
- 'menu_name' => __('Tags', 'flotheme'),
- ),
- 'show_ui' => true,
- 'update_count_callback' => '_update_post_term_count',
- 'query_var' => true,
- 'rewrite' => array('slug' => $gallery_tags_permalink),
- );
- register_taxonomy('gallery-category', 'gallery', $gallery_category);
- register_taxonomy('gallery-tag', 'gallery', $gallery_tag);
- /* EOF register tags and categories taxonomies for gallery posts */
- /*register categories taxonomies for testimonial posts*/
- $testimonial_category = array(
- 'hierarchical' => true,
- 'labels' => array(
- 'name' => _x( 'Testimonial Categories', 'taxonomy general name' ,'flotheme' ),
- 'singular_name' => _x( 'Testimonial Category', 'taxonomy singular name','flotheme' ),
- 'search_items' => __( 'Search Categories', 'flotheme' ),
- 'all_items' => __( 'All Categories', 'flotheme' ),
- 'parent_item' => __( 'Parent Category', 'flotheme' ),
- 'parent_item_colon' => __( 'Parent Category:', 'flotheme' ),
- 'edit_item' => __( 'Edit Category', 'flotheme' ),
- 'update_item' => __( 'Update Category', 'flotheme' ),
- 'add_new_item' => __( 'Add New Category', 'flotheme' ),
- 'new_item_name' => __( 'New Category Name', 'flotheme' ),
- 'menu_name' => __( 'Categories', 'flotheme' ),
- ),
- 'show_ui' => true,
- 'query_var' => true,
- 'rewrite' => array( 'slug' => 'testimonial-category' ),
- );
- register_taxonomy('testimonial-category', 'testimonial', $testimonial_category);
- /* EOF register categories for testimonial posts */
- /**
- * Load Theme Variable Data
- * @param string $var
- * @return string
- */
- function theme_data_variable($var)
- {
- if (!is_file(STYLESHEETPATH . '/style.css')) {
- return '';
- }
- $theme_data = wp_get_theme();
- return $theme_data->{$var};
- }
- function get_post_categories($post_id, $only_first_cat = false, $taxonomy = 'category', $margin_elem_start = '', $margin_elem_end = '', $delimiter = ', ', $a_class = '', $show_cat_name = true)
- {
- $cat = '';
- $categories = wp_get_post_terms($post_id, $taxonomy);
- if (!empty($categories)) {
- $ind = 1;
- foreach ($categories as $category) {
- $categ = get_category($category);
- if ($ind != count($categories) && !$only_first_cat) {
- $cat_delimiter = $delimiter;
- } else {
- $cat_delimiter = '';
- }
- if ($show_cat_name) {
- $name = $categ->name;
- } else {
- $name = '';
- }
- $cat .= $margin_elem_start . '<a href="' . get_category_link($category) . '" class="' . $a_class . '">' . $name . $cat_delimiter . '</a>' . $margin_elem_end;
- if ($only_first_cat) {
- break;
- }
- $ind++;
- }
- //$cat = __('in','flotheme').' '. $cat;
- }
- return $cat . ' ';
- }
- function load_google_fonts()
- {
- $protocol = is_ssl() ? 'https' : 'http';
- $result = '';
- $fonts = array();
- // $default_system_fonts = array(
- // "Cantarell, Tahoma, Verdana, Helvetica, sans-serif",
- // "'Unica One', Arial, Helvetica, sans-serif",
- // "'Montserrat Subrayada', Arial, Helvetica, sans-serif",
- // 'Arial, Helvetica, sans-serif',
- // 'Times, Georgia, serif',
- // 'Verdana, Tahoma, sans-serif',
- // "'Century Gothic', Helvetica, Arial, sans-serif",
- // 'Helvetica, Arial, sans-serif',
- // 'Georgia, Times, serif',
- // "'Lucida Grande', 'Lucida Sans Unicode', Tahoma, Verdana, sans-serif",
- // 'Palatino, Georgia, serif',
- // 'Tahoma, Verdana, Helvetica, sans-serif',
- // 'Garamond, Palatino, Georgia, serif',
- // 'Courier, monospace',
- // "'Trebuchet MS', Tahoma, Helvetica, sans-serif",
- // "'Comic Sans MS', Arial, sans-serif",
- // 'Bookman, Palatino, Georgia, serif'
- // );
- $default_system_fonts = array(
- "Cantarell",
- "Unica One",
- //"Montserrat Subrayada",
- 'Arial',
- 'Times',
- 'Verdana',
- "Century Gothic",
- 'Helvetica',
- 'Georgia',
- "Lucida Grande",
- 'Palatino',
- 'Tahoma',
- 'Garamond',
- 'Courier',
- "Trebuchet MS",
- "Comic Sans MS",
- 'Bookman'
- );
- $typo = options::get_value('typography');
- //deb::e($typo);
- $settings_fonts = array(
- //$typo[ 'general_font_font_family' ],
- $typo[ 'menu_links_font_family'],
- //$typo[ 'menu_menu_description_family'],
- $typo[ 'header_mobile_label_font_family'],
- $typo[ 'slideshow_title_font_family'],
- $typo[ 'slideshow_description_font_family'],
- $typo[ 'logo_font_font_family'],
- $typo[ 'h1_font_font_family'],
- $typo[ 'h2_font_font_family'],
- $typo[ 'h3_font_font_family'],
- $typo[ 'h4_font_font_family'],
- $typo[ 'h5_font_font_family'],
- $typo[ 'h6_font_font_family'],
- $typo[ 'content_text_font_family'],
- $typo[ 'pretitle_font_font_family'],
- $typo[ 'subtitle_font_font_family'],
- $typo[ 'share_font_font_family'],
- $typo[ 'meta_font_font_family' ],
- $typo[ 'inputs_font_family'],
- $typo[ 'pagination_font_font_family'],
- $typo[ 'footer_title_font_family'],
- $typo[ 'footer_description_font_family'],
- $typo[ 'footer_bottom_text_font_family'],
- $typo[ 'mosaic_title_font_font_family'],
- $typo[ 'mosaic_content_font_font_family'],
- );
- if (options::get_value('styling', 'logo_type') == 'text') {
- $settings_fonts[] = options::get_value('styling', 'logo_font_family');
- }
- foreach ($settings_fonts as $font) {
- if (options::get_value('typography', 'google_fonts_api_key') == '') { // if google api key is not used
- if (!empty($font)) {
- if (strpos($font, '&v1') === false) {
- $font .= '&v1';
- }
- }
- }
- if (!in_array($font, $fonts)) {
- $fonts[] = $font; /*append each font only 1 time*/
- }
- }
- // check if there are any custom fonts
- $custom_fonts = get_option('_customfonts');
- $custom_fonts_array = array();
- if (is_array($custom_fonts) && sizeof($custom_fonts)) {
- foreach ($custom_fonts as $key => $custom_font) {
- if (isset($custom_font['title']) && strlen($custom_font['title']) && isset($custom_font['fonturl']) && cosmo_isValidURL($custom_font['fonturl'])) {
- //$custom_fonts_array[$custom_font['title']] = $custom_font['fonturl'];
- $custom_fonts_array[$custom_font['title']] = $custom_font;
- }
- }
- }
- $flo_custom_fonts = '';
- $counter = 1;
- foreach ($fonts as $g_font) {
- if (strlen( trim(trim($g_font),'&v1') )) {
- if (array_key_exists(str_replace('&v1', '', $g_font), $custom_fonts_array)) { // if used font is a custom font we will load it from local source
- $c_font = $custom_fonts_array[str_replace('&v1', '', $g_font)];
- //wp_enqueue_style( 'cosmo-gfont-'.$counter, "$c_font" );
- $c_fonts_url = flo_get_custom_font_urls($c_font);
- ob_start();
- ob_clean();
- ?>
- @font-face {
- font-family: '<?php echo str_replace('&v1', '', $g_font) ?>';
- font-style: normal;
- src: local('<?php echo str_replace('&v1', '', $g_font) ?>'), <?php echo $c_fonts_url; ?>;
- }
- <?php
- $flo_custom_fonts .= ob_get_clean();
- } else {
- // usually we have this case when the fonts are loaded usin API KEY and we have several versions of the
- // same font and font name is devided by font style by '|'
- if (strstr($g_font, '|') !== false) {
- $family_exploded = explode('|', $g_font);
- if(strlen(trim($family_exploded[0]))){ // if the current font has a name (the default font has no name)
- $font_style_url = $protocol . '://fonts.googleapis.com/css?family=' . trim($family_exploded[0]); // font name
- if (isset($family_exploded[1]) && trim($family_exploded[1]) != 'regular') {
- $font_style_url .= ":" . trim($family_exploded[1]); // add the font style if necessary
- }
- wp_enqueue_style('flo-gfont-' . $counter, "$font_style_url");
- }
- } else {
- // enque the font only if it is a google font and not a default one
- if (!in_array(str_replace('&v1', '', $g_font), $default_system_fonts) && !flo_is_system_font($g_font, $default_system_fonts) ) {
- $the_font = str_replace(' ', '+', trim($g_font));
- if(strlen(trim($the_font))){ // if the current font has a name (the default font has no name)
- wp_enqueue_style('flo-gfont-' . $counter, "$protocol://fonts.googleapis.com/css?family=$the_font' rel='stylesheet' type='text/css");
- }
- }
- }
- }
- }
- $counter++;
- }
- if (strlen($flo_custom_fonts)) {
- ?>
- <style type="text/css"> <?php echo $flo_custom_fonts; ?> </style> <?php
- }
- }
- /*
- * Function flo_get_custom_font_urls
- *
- * Creates the source for the uploaded custom fonts
- *
- * @font_struct (array) array containing the font name and up to 4 URLs
- * @return (str) - the source URLs ready to be used in css for font-face
- */
- function flo_get_custom_font_urls($font_struct){
- $src_url = '';
- if(isset($font_struct['fonturl'])){
- $src_url = 'url('.$font_struct['fonturl'].' )' . flo_get_font_format($font_struct['fonturl']);
- }
- // check and load the fonts added in the fields 2,3,4
- for($i = 2; $i<5; $i++){
- if(isset( $font_struct[$i.'fonturl'] ) && strlen($font_struct[$i.'fonturl']) ){ // if the user uploaded a font in the current field, we will add it
- $src_url .= ', '. 'url('.$font_struct[$i.'fonturl'].' )' . flo_get_font_format($font_struct[$i.'fonturl']);
- }
- }
- return $src_url;
- }
- function flo_get_font_format($font_url){
- // expected input parameter:
- // http://demo.flothemes.com/cozy/files/2014/09/brandon_reg.otf
- $font_format_options = array('svg' => 'svg',
- 'otf' => 'opentype',
- 'woff' => 'woff',
- 'ttf' => 'truetype'
- );
- $font_format = '';
- if(strstr($font_url, '.')){ // check if the given url has a dot
- $font_url_array = explode('.', $font_url);
- $font_extention = $font_url_array[sizeof($font_url_array)-1]; // this should match the font extention. i.e. 'otf'
- $font_format = " format('".$font_format_options[$font_extention]."')";
- }
- return $font_format;
- }
- /*
- * Check if a font is a a system font
- * $params:
- * $font - str -> the passed font
- * $default_system_fonts - array with used default fonts
- * return: bool
- */
- function flo_is_system_font($font, $default_system_fonts){
- // If it is a system font then it should come in a format like this:
- // Verdana, Tahoma, sans-serif
- // So we want to split the input tring by ',', and
- if(strstr($font, ',')){
- $font_array = explode(',', $font);
- if(in_array($font_array[0], $default_system_fonts)){
- return true;
- }else{
- return false;
- }
- }else{
- return false;
- }
- }
- function flo_get_logo()
- {
- global $logo_class;
- $logo_type = options::get_value('styling', 'logo_type');
- if ($logo_type == 'image') {
- $sl_info = flo_get_page_slyder_info();
- $logo_pos_options = array('top-left','top-center','top-right','middle-left','middle-center','middle-right');
- $slideshow_logo_img = options::get_value('styling', 'slideshow_logo_url');
- $main_logo_img = options::get_value('styling', 'logo_url');
- if(!strlen($slideshow_logo_img)){
- $slideshow_logo_img = $main_logo_img;
- }
- //var_dump(strlen(trim($slideshow_logo_img)),is_flo_full_slider_width_page() );
- if( strlen(trim($slideshow_logo_img)) && is_flo_full_slider_width_page() && isset($sl_info['selected_slider_id']) && is_numeric($sl_info['selected_slider_id'])
- && $sl_info['selected_slider_id'] > 0 && isset($sl_info['logo_position']) && (in_array($sl_info['logo_position'], $logo_pos_options ) || $sl_info['logo_position'] == 'logo-inside-menu' && $sl_info['menu_position'] == 'crowd-header-over' ) ){
- if(strlen($slideshow_logo_img)){
- $logo_img = $slideshow_logo_img;
- }else{
- $logo_img = $main_logo_img;
- }
- $desktop_size = options::get_value('styling', 'max_logo_width_desktop_slideshow_page');
- }else{
- $logo_img = $main_logo_img;
- $desktop_size = options::get_value('styling', 'max_logo_width_desktop');
- }
- if ($logo_img) {
- $logo_class = ' site-logo ';
- $mobile_logo_img = options::get_value('styling', 'logo_url_mobile');
- // $logo_dim = aq_resize( esc_url($logo_img), '9999', '99999', false, false );
- $orig_w = isset($logo_dim[1]) ? $logo_dim[1] : '';
- $orig_h = isset($logo_dim[2]) ? $logo_dim[2] : '';
- $mobile_size = options::get_value('styling', 'max_logo_width_mobile')? options::get_value('styling', 'max_logo_width_mobile'): 9999;
- if(strlen($mobile_logo_img)){
- // $mobile_logo_img = aq_resize( esc_url($mobile_logo_img), $mobile_size, 9999, false, true);
- $mobile_logo = "<img src='" . $mobile_logo_img . "' alt='".get_bloginfo('name')."' class='crowd-mobile-logo' />";
- }else{
- // $m_logo_img = aq_resize( esc_url($logo_img), $mobile_size, 9999, false, true);
- $mobile_logo = "<img src='" . $logo_img . "' alt='".get_bloginfo('name')."' class='crowd-mobile-logo' />";
- }
- $desktop_size = $desktop_size? $desktop_size: 9999;
- // $logo_img = aq_resize( esc_url($logo_img), $desktop_size, 9999, false, true);
- $logo = "<div class='site-title'>
- <a class='logo' href='".home_url()."' rel='home' >
- <img src='" . $logo_img . "' alt='".get_bloginfo('name')."' class='crowd-descktop-logo' width='".$orig_w."' height='".$orig_h."' />
- ".$mobile_logo."
- </a>
- </div>";
- } else {
- $logo_class = ' ';
- $logo = NULL;
- }
- if (!$logo) {
- $logo .= '<div class="site-title"><a href="'.home_url().'" rel="home">'.get_bloginfo('name').'</a></div>';
- $logo_class = ' ';
- }
- } else {
- $logo_class = ' ';
- $logo = '<div class="site-title"><a href="'.home_url().'" rel="home">'.get_bloginfo('name').'</a></div>';
- }
- return $logo;
- }
- function get_item_label($item)
- {
- $item = basename($item);
- $item = str_replace('-', ' ', $item);
- return $item;
- }
- function get__categories($nr = -1)
- {
- $categories = get_categories();
- $result = array();
- foreach ($categories as $key => $category) {
- if ($key == $nr) {
- break;
- }
- if ($nr > 0) {
- $result[$category->term_id] = $category->term_id;
- } else {
- $result[$category->term_id] = $category->cat_name;
- }
- }
- return $result;
- }
- function get__pages($first_label = 'Select item')
- {
- $pages = get_pages();
- $result = array();
- if (is_array($first_label)) {
- $result = $first_label;
- } else {
- if (strlen($first_label)) {
- $result[] = $first_label;
- }
- }
- foreach ($pages as $page) {
- $result[$page->ID] = $page->post_title;
- }
- return $result;
- }
- /**
- * adds the language switcher to the menu object
- *
- * @params:
- * $items - string, the menu items in html format
- * $args - array, menu config arguments
- * @return - string, the modified menu with them logo in the middle
- */
- if (!function_exists('flo_add_lang_switcher_to_nav')) {
- function flo_add_lang_switcher_to_nav($items, $args){
- if(is_object($args->walker)){
- ob_start();
- get_sidebar( 'header-translation' );
- $lang_switcher = ob_get_contents();
- ob_end_clean();
- $items .= '<li class="menu-lang-switcher">'.$lang_switcher.'</li>';
- return $items;
- }else{
- return $items;
- }
- }
- }
- /**
- * adds the logo to the menu object
- *
- * @params:
- * $items - string, the menu items in html format
- * $args - array, menu config arguments
- * @return - string, the modified menu with them logo in the middle
- */
- if (!function_exists('flo_add_menu_to_nav')) {
- function flo_add_menu_to_nav($items, $args){
- if(is_object($args->walker)){
- $number_menu_items = $args->walker->count;
- // now we need to find the index of the menu item where the LOGO will be inserted. i.e. if the menu has 6 menu items, then the logo will be inserted after the 3rd elem.
- $before_logo_index = round( $number_menu_items/2);
- if(!class_exists('simple_html_dom_node')){ // make sure we will not have conflicts with other plugins that are using simple_html_dom class
- require('simple_html_dom.php');
- }
- // now we will parse the menu items dom using simple_html_dom library
- $html = new simple_html_dom();
- $html->load('<ul class="temp-wrapper">'.$items.'</ul>');
- $temp_wrapper = $html->find('.description', 0);
- if(($temp_wrapper)) {
- $menu_items = $html->find('.temp-wrapper', 0)->children(); // get just the top level menu items
- $new_menu = ''; // init and empty menu that will be built from the old menu + the logo
- foreach ($menu_items as $key => $value) {
- $original_class = $value->class;
- // update the class
- if( $key < $before_logo_index){
- $value->class = $original_class . ' left-logo-menu ';
- }else{
- $value->class = $original_class . ' right-logo-menu ';
- }
- $new_menu .= $value->outertext;
- // if we are in the middle of the menu, add the logo
- if($before_logo_index == $key+1){
- $the_logo = flo_get_logo();
- $new_menu .= '<li class="menu-item logo-inside site-logo">'.$the_logo.'</li>';
- }
- }
- }
- return $new_menu;
- }else{
- return $items;
- }
- }
- }
- function get__posts($args = array(), $first_label = 'Select item')
- {
- $posts = get_posts($args);
- $result = array();
- if (is_array($first_label)) {
- $result = $first_label;
- } else {
- if (strlen($first_label)) {
- $result[] = $first_label;
- }
- }
- if (is_array($posts) && !empty($posts)) {
- foreach ($posts as $post) {
- $result[$post->ID] = $post->post_title;
- }
- }
- return $result;
- }
- function menu($id, $args = array())
- {
- $menu = new menu($args);
- $vargs = array(
- 'menu' => '',
- 'container' => '',
- 'container_class' => '',
- 'container_id' => '',
- 'menu_class' => isset($args['class']) ? $args['class'] : '',
- 'menu_id' => '',
- 'echo' => false,
- 'fallback_cb' => 'flo_page_menu',
- 'before' => '',
- 'after' => '',
- 'link_before' => '',
- 'link_after' => '',
- 'depth' => 0,
- 'walker' => $menu,
- 'theme_location' => $id,
- 'nr_items_per_column' => isset($args['nr_items_per_column']) ? $args['nr_items_per_column'] : 9999, /// if you don't want to have several columns in menu, set 9999
- );
- $result = wp_nav_menu($vargs);
- if ($menu->need_more && $id != 'megusta') {
- $result .= "</li></ul>" . $menu->aftersubm;
- }
- return $result;
- }
- /**
- * Override the defaul WP_page_menu function to have the output we need
- * Display or retrieve list of pages with optional home link.
- *
- * The arguments are listed below and part of the arguments are for {@link
- * wp_list_pages()} function. Check that function for more info on those
- * arguments.
- *
- * @since 4.0.0
- *
- * @param array|string $args {
- * Optional. Arguments to generate a page menu. {@see wp_list_pages()}
- * for additional arguments.
- *
- * @type string $sort_column How to short the list of pages. Accepts post column names.
- * Default 'menu_order, post_title'.
- * @type string $menu_class Class to use for the div ID containing the page list. Default 'menu'.
- * @type bool $echo Whether to echo the list or return it. Accepts true (echo) or false (return).
- * Default true.
- * @type string $link_before The HTML or text to prepend to $show_home text. Default empty.
- * @type string $link_after The HTML or text to append to $show_home text. Default empty.
- * @type int|string $show_home Whether to display the link to the home page. Can just enter the text
- * you'd like shown for the home link. 1|true defaults to 'Home'.
- * }
- * @return string html menu
- */
- function flo_page_menu( $args = array() ) {
- $defaults = array('sort_column' => 'menu_order, post_title', 'menu_class' => 'menu', 'echo' => true, 'link_before' => '', 'link_after' => '');
- $args = wp_parse_args( $args, $defaults );
- $menu = '';
- $list_args = $args;
- // Show Home in the menu
- if ( ! empty($args['show_home']) ) {
- if ( true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home'] )
- $text = __('Home','flotheme');
- else
- $text = $args['show_home'];
- $class = '';
- if ( is_front_page() && !is_paged() )
- $class = 'class="current_page_item"';
- $menu .= '<li ' . $class . '><a href="' . home_url( '/' ) . '">' . $args['link_before'] . $text . $args['link_after'] . '</a></li>';
- // If the front page is a page, add it to the exclude list
- if (get_option('show_on_front') == 'page') {
- if ( !empty( $list_args['exclude'] ) ) {
- $list_args['exclude'] .= ',';
- } else {
- $list_args['exclude'] = '';
- }
- $list_args['exclude'] .= get_option('page_on_front');
- }
- }
- $list_args['echo'] = false;
- $list_args['title_li'] = '';
- $menu .= str_replace( array( "\r", "\n", "\t" ), '', wp_list_pages($list_args) );
- if ( $menu )
- $menu = '<ul class="' . esc_attr($args['menu_class']) . '">' . $menu . '</ul>';
- //$menu = '<div class="' . esc_attr($args['menu_class']) . '">' . $menu . "</div>\n";
- if ( $args['echo'] )
- echo $menu;
- else
- return $menu;
- }
- if (!function_exists('clear_meta')) {
- function clear_meta($post_id)
- {
- $resources = array('conference' => array('sponsor', 'presentation', 'exhibitor'), 'presentation' => array('speaker'));
- foreach ($resources as $res => $boxes) {
- $posts = get_posts(array('post_type' => $res));
- foreach ($posts as $post) {
- foreach ($boxes as $box) {
- $box_meta = meta::get_meta($post->ID, $box);
- foreach ($box_meta as $index => $meta) {
- if ($meta['idrecord'] == $post_id) {
- meta::delete($res, $box, $post->ID, '', $index);
- }
- }
- }
- }
- }
- }
- }
- if (!function_exists('cosmo_breadcrumbs')) {
- function cosmo_breadcrumbs()
- {
- $delimiter = '';
- $home = __('Home', 'flotheme'); // text for the 'Home' link
- $start_container = '<ul>';
- $end_container = '</ul>';
- $before = '<li>'; // tag before the current crumb
- $after = '</li>'; // tag after the current crumb
- if (!is_front_page() || is_paged()) {
- /*echo '<div id="crumbs">';*/
- global $post;
- $homeLink = home_url();
- echo $start_container;
- echo '<li><a href="' . $homeLink . '">' . $home . '</a> </li>' . $delimiter . ' ';
- if (is_category()) {
- global $wp_query;
- $cat_obj = $wp_query->get_queried_object();
- $thisCat = $cat_obj->term_id;
- $thisCat = get_category($thisCat);
- $parentCat = get_category($thisCat->parent);
- if ($thisCat->parent != 0)
- echo($before . get_category_parents($parentCat, true, ' ' . '</li><li>' . ' ') . $after);
- echo $before . __('Archive by category', 'flotheme') . ' "' . single_cat_title('', false) . '"' . $after;
- } elseif (is_day()) {
- echo $before . '<a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a> ' . $after . $delimiter . ' ';
- echo $before . '<a href="' . get_month_link(get_the_time('Y'), get_the_time('m')) . '">' . get_the_time('F') . '</a> ' . $after . $delimiter . ' ';
- echo $before . get_the_time('d') . $after;
- } elseif (is_month()) {
- echo $before . '<a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a> ' . $after . $delimiter . ' ';
- echo $before . get_the_time('F') . $after;
- } elseif (is_year()) {
- echo $before . get_the_time('Y') . $after;
- } elseif (is_single() && !is_attachment()) {
- if (get_post_type() != 'post') {
- $post_type = get_post_type_object(get_post_type());
- $slug = $post_type->rewrite;
- echo $before . '<a href="' . $homeLink . '/' . $slug['slug'] . '/">' . $post_type->labels->singular_name . '</a> ' . $after . $delimiter . ' ';
- echo $before . get_the_title() . $after;
- } else {
- $cat = get_the_category();
- $cat = $cat[0];
- //echo $before . get_category_parents($cat, TRUE, ' ' . '</li><li>' . ' ') . $after;
- echo $before . get_category_parents($cat, true, ' ') . $after;
- echo $before . get_the_title() . $after;
- }
- } elseif (!is_single() && !is_page() && get_post_type() != 'post' && !is_404()) {
- $post_type = get_post_type_object(get_post_type());
- if ($post_type) {
- echo $before . $post_type->labels->singular_name . $after;
- }
- } elseif (is_attachment()) {
- $parent = get_post($post->post_parent);
- /*$cat = get_the_category($parent->ID); $cat = $cat[0];*/
- /*echo $before . get_category_parents($cat, TRUE, ' ' . $delimiter . ' ') . $after;*/
- echo $before . '<a href="' . get_permalink($parent) . '">' . $parent->post_title . '</a> ' . $after . $delimiter . ' ';
- echo $before . get_the_title() . $after;
- } elseif (is_page() && !$post->post_parent) {
- echo $before . get_the_title() . $after;
- } elseif (is_page() && $post->post_parent) {
- $parent_id = $post->post_parent;
- $breadcrumbs = array();
- while ($parent_id) {
- $page = get_page($parent_id);
- $breadcrumbs[] = $before . '<a href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a>' . $after;
- $parent_id = $page->post_parent;
- }
- $breadcrumbs = array_reverse($breadcrumbs);
- foreach ($breadcrumbs as $crumb)
- echo $crumb . ' ' . $delimiter . ' ';
- echo $before . get_the_title() . $after;
- } elseif (is_search()) {
- echo $before . __('Search results for', 'flotheme') . ' "' . get_search_query() . '"' . $after;
- } elseif (is_tag()) {
- echo $before . __('Posts tagged', 'flotheme') . ' "' . single_tag_title('', false) . '"' . $after;
- } elseif (is_author()) {
- global $author;
- $userdata = get_userdata($author);
- echo $before . __('Articles posted by ', 'flotheme') . $userdata->display_name . $after;
- } elseif (is_404()) {
- echo $before . __('Error 404', 'flotheme') . $after;
- }
- if (get_query_var('paged')) {
- if (is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author())
- echo ' (';
- echo __('Page', 'flotheme') . ' ' . get_query_var('paged');
- if (is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author())
- echo ')';
- }
- if (is_home()) {
- echo $before . __('Blog', 'flotheme') . $after;
- }
- echo $end_container;
- /*echo '</div>';*/
- }
- } /* end cosmo_breadcrumbs()*/
- }
- if (!function_exists('cosmo_get_custom_css')) {
- function cosmo_get_custom_css()
- {
- if (strlen(options::get_value('colors', 'thumb_bg_opacity'))) {
- $thumb_bg_opacity = options::get_value('colors', 'thumb_bg_opacity');
- } else {
- $thumb_bg_opacity = '';
- }
- $logo_position = options::get_value('header_settings', 'logo_position');
- $post_images_distance = options::get_value('blog_post', 'images_distance'); // The horizontal distance between images inserted in hte post content
- $single_layout_padding_top = options::get_value('blog_post', 'single_title_padding_top');
- $single_layout_padding_bottom = options::get_value('blog_post', 'single_title_padding_bottom');
- $background_img = '';
- $header_background_img = '';
- $background_color = '';
- $position = '';
- $repeat = '';
- $bgatt = '';
- $thumb_hover_background_img = '';
- // $slide_img_width = options::get_value('imagesizes', 'list_view_width') . 'px';
- $home_grid_horizontal_height = options::get_value('imagesizes', 'height_horizontal_home') . 'px';
- $home_grid_vertical_height = options::get_value('imagesizes', 'height_vertical_home') . 'px';
- /* header 1 submenu font size */
- $navigation_font_size = options::get_value('typography', 'navigation_font_font_size');
- $submenu_nav_font_size = $navigation_font_size - 2;
- $header_uppercase_menu = options::get_value('header_settings', 'header_uppercase_menu');
- ?>
- <!--Custom CSS-->
- <?php if (strlen(options::get_value('custom_css', 'css')) > 0) { ?>
- <style type="text/css">
- <?php echo options::get_value( 'custom_css' , 'css' ); ?>
- </style>
- <?php } ?>
- <style type="text/css">
- <?php
- $grid_hover_color = options::get_value( 'content_settings' , 'grid_hover_color' );
- if(isset($grid_hover_color) && $grid_hover_color != ''){?>
- @media only screen and (min-width: 64.063em){
- .title-over .post-preview-hidden {
- background-color: <?php echo $grid_hover_color;?>;
- }
- }
- <?php }?>
- <?php
- $grid_padding = options::get_value( 'content_settings' , 'grid_padding' );
- if(isset($grid_hover_color) && $grid_hover_color != ''){?>
- @media only screen and (min-width: 64.063em){
- .title-over .post-preview-hidden {
- left: <?php echo $grid_padding;?>px!important;
- right: <?php echo $grid_padding;?>px!important;
- top: <?php echo $grid_padding;?>px!important;
- bottom: <?php echo $grid_padding;?>px!important;
- }
- }
- <?php }?>
- <?php if(isset($header_uppercase_menu) && $header_uppercase_menu == 'yes'){;?>
- .nav-menu li a{
- text-transform: uppercase;
- }
- <?php } ?>
- <?php if(is_numeric($single_layout_padding_top)){?>
- .single-layout-width .post-article-title-left, .single-layout-width{
- padding-top: <?php echo $single_layout_padding_top;?>px;
- }
- <?php }
- if(is_numeric($single_layout_padding_bottom)){?>
- .single-layout-width .post-header{
- margin-bottom: <?php echo $single_layout_padding_bottom;?>px;
- }
- <?php
- }
- $gallery_height = options::get_value('imagesizes','single_gallery_desktop_height');
- if($gallery_height){?>
- #gallery-slider .royalSlider, #full-width-slider .bx-wrapper{
- max-height: <?php echo $gallery_height?>px;
- }
- .gallery-slider .flo-slick-slider{
- height: <?php echo $gallery_height; ?>px;
- }
- <?php } ?>
- <?php
- $slick_sl_images_gutter = options::get_value( 'sliders' , 'gallery_visible_nearby_gutter' );
- if(is_numeric($slick_sl_images_gutter)){
- ?>
- .flo-slick-slider .slick-slide{
- padding: 0px <?php echo $slick_sl_images_gutter; ?>px;
- }
- <?php
- }
- $slick_main_slideshow_images_gutter = options::get_value( 'sliders' , 'visible_nearby_gutter' );
- if(is_numeric($slick_sl_images_gutter)){
- ?>
- .main-slideshow .flo-slick-slider .slick-slide{
- padding: 0px <?php echo $slick_main_slideshow_images_gutter/2; ?>px;
- }
- <?php
- }
- $gallery_mobile_height = options::get_value('imagesizes','single_gallery_mobile_height');
- if( is_numeric($gallery_mobile_height) ){ ?>
- @media only screen and (max-width: 640px) {
- #gallery-slider .royalSlider, #full-width-slider .bx-wrapper {
- max-height: <?php echo $gallery_mobile_height ?>px;
- }
- .full-width-slider .bx-viewport {
- height: <?php echo $gallery_mobile_height?>px !important;
- }
- .gallery-slider .flo-slick-slider {
- height: <?php echo $gallery_mobile_height; ?>px;
- }
- }
- <?php }
- //typography styles
- /*the array keys are the same as the typography options name, and the value are elemets to which the fonts must be applied */
- $typography_settings = array(
- 'menu_links' => '.primary-navigation .nav-menu a, .menu-one-column.logo-left .primary-navigation li a, .menu-one-column.logo-right .primary-navigation li a',
- 'menu_description' => '.nav-menu li a > .menu-description',
- 'header_mobile_label' => '.menu-toggle i:before, .menu-toggle span',
- 'slideshow_title' => '.slide-content .post-title .slide-title',
- 'slideshow_description' => '.slide-content .post-title .post-title-after',
- 'logo_font' => '.site-logo div.site-title a, .site-title, .nav-menu .site-title',
- 'h1_font' => 'h1, h1.post-title, .single-gallery .post-title',
- 'h2_font' => 'h2' ,
- 'h3_font' => 'h3, .grid-view h3',
- 'h4_font' => 'h4',
- 'h5_font' => 'h5',
- 'h6_font' => 'h6',
- 'content_text' => 'body, p, span, #content-sidebar ul li a, ul',
- 'pretitle_font' => '.post-title-before',
- 'subtitle_font' => '.post-title .post-title-after, .page-template-template-contact-form .contact-form p, .ninja-forms-all-fields-wrap .text-wrap label, .ninja-forms-all-fields-wrap .textarea-wrap label, .ninja-forms-form-wrap label',
- 'share_font' => '.post-note, .post-comment, .post-tag-entry, .post-tag span, .post-tag a, .share-link, .comment-item, .social-text',
- 'meta_font' => '.post-date a .post-date, .post-category a, .post-date time, .post-category .category-item',
- 'pagination_font' => '.pagination span, .pagination a',
- 'inputs' => 'input[type="text"], input[type="password"], input[type="date"], input[type="datetime"], input[type="datetime-local"], input[type="month"],input[type="week"], input[type="email"], input[type="number"], input[type="search"], input[type="tel"], input[type="time"], input[type="url"], input[type="button"],input[type="submit"], textarea',
- 'footer_title' => '.widget-title',
- 'footer_description' => '.button-title-link, .button-title-link span',
- 'footer_bottom_text' => '.footer-bottom, .footer-bottom a, .footer-bottom span, .footer-bottom p, .footer-bottom div, .footer-bottom span',
- 'mosaic_content_font' => '.mosaic-description',
- 'mosaic_title_font' => '.mosaic-title',
- );
- // use 'flo_custom_typography_settings' filter to overwrite the default typography settings elements
- // it can be used to add more elemnts to be affected by a gived option
- $typography_settings = apply_filters('flo_custom_typography_settings', $typography_settings);
- echo flo_set_typography( $typography_settings );
- ?>
- <?php
- $full_sidebar_below_header_margin_top = (int)options::get_value( 'blog_post' , 'full_sidebar_below_header_margin_top' );
- $full_sidebar_below_header_margin_bottom = (int)options::get_value( 'blog_post' , 'full_sidebar_below_header_margin_bottom' );
- if(is_numeric($full_sidebar_below_header_margin_top)){
- ?>.below-header-full-width{ margin-top: <?php echo $full_sidebar_below_header_margin_top; ?>px; }<?php
- }
- if(is_numeric($full_sidebar_below_header_margin_bottom)){
- ?>.below-header-full-width{ margin-bottom: <?php echo $full_sidebar_below_header_margin_bottom; ?>px; }<?php
- }
- $max_desktop_logo_width = options::get_value( 'styling' , 'max_logo_width_desktop' );
- $max_desktop_logo_width_slideshow_page = options::get_value( 'styling' , 'max_logo_width_desktop_slideshow_page' );
- $max_mobile_logo_width = options::get_value( 'styling' , 'max_logo_width_mobile' );
- $site_width = options::get_value( 'layout' , 'site_width' );
- if(!is_numeric($site_width)){
- $site_width = 1130;
- }
- ?>
- .row{ max-width: <?php echo $site_width; ?>px; } /*max site content width*/
- <?php
- if(is_numeric($max_desktop_logo_width)){
- ?>
- .site-logo .logo img
- {
- max-width: <?php echo $max_desktop_logo_width ?>px;
- }
- <?php
- }
- if(is_numeric($max_desktop_logo_width_slideshow_page)){
- ?>
- .crowd-site-identity .site-logo .logo img
- {
- max-width: <?php echo $max_desktop_logo_width_slideshow_page ?>px;
- }
- <?php
- }
- if(is_numeric($max_mobile_logo_width)){
- ?>
- @media only screen and (max-width: 600px)
- {
- .site-logo .logo img, .crowd-layout .site-header .logo img
- {
- width: <?php echo $max_mobile_logo_width ?>px;
- }
- }
- <?php
- }
- ?>
- <?php
- if(is_numeric($post_images_distance)){
- ?>
- .single div.post-content a img, .single div.post-content img, body img.alignleft, body img.alignright, body img.aligncenter, body img.alignnone,
- .gallery-shortcode.flo-1-columns
- {
- margin-bottom: <?php echo $post_images_distance; ?>px;
- }
- <?php
- }
- $site_width = options::get_value( 'layout' , 'site_width' );
- if(!is_numeric($site_width)){
- $site_width = 1130;
- }
- // set the distance between Header 1 menu items such that the menu
- // will use the whole content width
- $header_1_menu_spacing = get_option('header_1_menu_spacing', '0px');
- if('0px' != $header_1_menu_spacing && $header_1_menu_spacing > 0){
- ?>
- @media only screen and (min-width: <?php echo $site_width+100; ?>px){
- body:not(.crowd-layout).header_style1 .nav-menu>li:not(:last-child){
- margin-right: <?php echo $header_1_menu_spacing; ?>
- }
- body.crowd-layout.crowd-simple-menu .site-header:not(.left-logo) .nav-menu>li:not(:last-child),
- body.crowd-layout.crowd-simple-menu .site-header:not(.right-logo) .nav-menu>li:not(:last-child),
- body.crowd-layout.crowd-simple-menu .site-header:not(.logo-inside-menu) .nav-menu>li:not(:last-child)
- {
- margin-right: <?php echo $header_1_menu_spacing; ?>
- }
- body.crowd-layout.crowd-simple-menu .site-header.logo-inside-menu .nav-menu>li:last-child,
- body.crowd-layout.crowd-simple-menu .site-header.logo-inside-menu .nav-menu>li.right-logo-menu,
- body.crowd-layout.crowd-simple-menu .site-header.logo-inside-menu .nav-menu>li.site-logo,
- body.crowd-layout.crowd-simple-menu .site-header .nav-menu>li:last-child{
- margin-right: 0px !important;
- }
- /*body.crowd-layout.crowd-simple-menu .site-header.logo-inside-menu .nav-menu>li:not(:right-logo-menu)*/
- }
- <?php
- }
- ?>
- @media only screen and (min-width: 641px) and (max-width: <?php echo $site_width+99; ?>px){
- .header_style4 .site-navigation .nav-menu>li{
- margin-right: 20px !important;
- margin-left: 0px !important;
- }
- }
- /* fix for the menu items distance if the screen width is smaller that the site content width */
- @media only screen and (min-width: 641px) and (max-width: <?php echo $site_width+100; ?>px){
- .header_style1 .nav-menu>li:not(:last-child){
- margin-right: 15px !important;
- }
- }
- <?php
- // set the distance between Header 4 menu items such that the menu
- // will use the whole content width
- $header_4_menu_left_spacing = get_option('header_4_menu_left_spacing', '0px');
- $header_4_menu_right_spacing = get_option('header_4_menu_right_spacing', '0px');
- ?>
- @media only screen and (min-width: <?php echo $site_width+100; ?>px){
- .primary-navigation > ul > li.site-logo, .primary-navigation > ul > li.right-logo-menu{
- margin-right: 0px;
- }
- .header_style4 .site-navigation .nav-menu>li.right-logo-menu{
- margin-right: 0px;
- }
- .header_style4 li.site-logo{ margin-right: 0px; }
- /*fixing the menu allignement styles*/
- <?php if( is_numeric(options::get_value('header_settings', 'menu1_spacing'))):?>
- .header_style1:not(.crowd-layout) .primary-navigation > ul > li,
- .header_style5:not(.crowd-layout) .primary-navigation > ul > li,
- .crowd-simple-menu .primary-navigation > ul > li{
- margin-right: <?php echo options::get_value('header_settings', 'menu1_spacing'); ?>px!important;
- }
- .header_style1:not(.crowd-layout) .primary-navigation > ul > li:last-child,
- .header_style5:not(.crowd-layout) .primary-navigation > ul > li:last-child,
- .crowd-simple-menu .primary-navigation > ul > li:last-child{
- margin-right: 15px !important;
- }
- <?php endif;?>
- <?php if(is_numeric(options::get_value('header_settings', 'menu2_spacing_left')) ):?>
- .header_style4 .primary-navigation > ul > li.left-logo-menu,
- .crowd-double-menu .primary-navigation > ul > li.left-logo-menu{
- margin-right: <?php echo options::get_value('header_settings', 'menu2_spacing_left'); ?>px !important;
- }
- <?php endif;?>
- <?php if(is_numeric(options::get_value('header_settings', 'menu2_spacing_right')) ):?>
- .header_style4 .primary-navigation > ul > li.right-logo-menu,
- .crowd-double-menu .primary-navigation > ul > li.right-logo-menu{
- margin-left: <?php echo options::get_value('header_settings', 'menu2_spacing_right'); ?>px !important;
- }
- <?php endif;?>
- }
- <?php
- $header_padding_top = options::get_value( 'header_settings' , 'header_padding_top' );
- $header_padding_bottom = options::get_value( 'header_settings' , 'header_padding_bottom' );
- $header_padding_top_mobile = options::get_value( 'header_settings' , 'header_padding_top_mobile' );
- $header_padding_bottom_mobile = options::get_value( 'header_settings' , 'header_padding_bottom_mobile' );
- $distance_before_footer_widgets = options::get_value( 'footer_settings' , 'distance_before_footer_widgets' );
- $footer_bottom_distance = options::get_value( 'footer_settings' , 'footer_bottom_distance' );
- $text_logo_padding = options::get_value( 'styling' , 'distance' );
- $content_padding = options::get_value( 'content_settings' , 'content_padding' );
- $distance_before_slideshow = options::get_value( 'sliders' , 'distance_before_slideshow' );
- $distance_after_slideshow = options::get_value( 'sliders' , 'distance_after_slideshow' );
- ?>
- @media only screen and (max-width: 640px)
- {
- /*header padding for mobiles*/
- <?php
- if(is_numeric($header_padding_top_mobile)){
- ?> header.site-header
- {
- padding-top: <?php echo $header_padding_top_mobile; ?>px;
- }
- <?php
- }
- ?>
- <?php
- if(is_numeric($header_padding_bottom_mobile)){
- ?> header.site-header
- {
- padding-bottom: <?php echo $header_padding_bottom_mobile; ?>px;
- }
- <?php
- }
- ?>
- }
- <?php
- if(is_numeric($distance_after_slideshow)){?>
- .main-slideshow{
- margin-bottom: <?php echo $distance_after_slideshow;?>px;
- }
- <?php }?>
- @media only screen and (min-width: 641px)
- {
- /*header padding for mobiles*/
- <?php
- if(is_numeric($header_padding_top)){ ?>
- header.site-header, .crowd-layout .site-header
- {
- padding-top: <?php echo $header_padding_top; ?>px;
- }
- <?php }?>
- <?php
- if(is_numeric($distance_before_footer_widgets)){?>
- .footer-top-inner{
- padding-top: <?php echo $distance_before_footer_widgets;?>px;
- }
- <?php }?>
- <?php
- if(is_numeric($footer_bottom_distance)){?>
- .footer-bottom{
- padding-top: <?php echo $footer_bottom_distance;?>px;
- padding-bottom: <?php echo $footer_bottom_distance;?>px;
- }
- <?php }?>
- <?php
- if(is_numeric($distance_before_slideshow)){?>
- .main-slideshow{
- padding-top: <?php echo $distance_before_slideshow;?>px;
- }
- <?php }?>
- <?php
- if(is_numeric($content_padding)){?>
- .layout-width, .single-layout-width{
- padding-top: <?php echo $content_padding;?>px!important;
- }
- <?php }?>
- <?php
- if(is_numeric($text_logo_padding)){?>
- header .site-identity.site-logo
- {
- padding-top: <?php echo $text_logo_padding; ?>px;
- padding-bottom: <?php echo $text_logo_padding; ?>px;
- }
- <?php }?>
- <?php
- if(is_numeric($header_padding_bottom)){ ?>
- header.site-header, .crowd-layout .site-header
- {
- padding-bottom: <?php echo $header_padding_bottom; ?>px;
- }
- <?php }?>
- }
- </style>
- <?php
- flo_get_custom_colors();
- }
- }
- /**
- * render custom color styles
- */
- if (!function_exists('flo_get_custom_colors')) {
- function flo_get_custom_colors()
- {
- if (strlen(options::get_value('colors', 'menu_links_color'))) {
- $menu_links_color = options::get_value('colors', 'menu_links_color');
- } else {
- $menu_links_color = '';
- }
- if (strlen(options::get_value('colors', 'submenu_background'))) {
- $submenu_background = options::get_value('colors', 'submenu_background');
- } else {
- $submenu_background = '';
- }
- if (strlen(options::get_value('colors', 'background_color'))) {
- $background_color = options::get_value('colors', 'background_color');
- } else {
- $background_color = '';
- }
- if (strlen(options::get_value('colors', 'content_text_color'))) {
- $content_text_color = options::get_value('colors', 'content_text_color');
- } else {
- $content_text_color = '';
- }
- if (strlen(options::get_value('sliders', 'margin_below_sliders'))) {
- $margin_below_sliders = options::get_value('sliders', 'margin_below_sliders');
- } else {
- $margin_below_sliders = '';
- }
- if (strlen(options::get_value('colors', 'pretitle_color'))) {
- $pretitle_color = options::get_value('colors', 'pretitle_color');
- } else {
- $pretitle_color = '';
- }
- if (strlen(options::get_value('colors', 'subtitle_color'))) {
- $subtitle_color = options::get_value('colors', 'subtitle_color');
- } else {
- $subtitle_color = '';
- }
- if (strlen(options::get_value('colors', 'meta_share_pagination'))) {
- $meta_share_pagination = options::get_value('colors', 'meta_share_pagination');
- } else {
- $meta_share_pagination = '';
- }
- if (strlen(options::get_value('colors', 'bottom_widget_background'))) {
- $bottom_widget_background = options::get_value('colors', 'bottom_widget_background');
- } else {
- $bottom_widget_background = '';
- }
- if (strlen(options::get_value('colors', 'footer_bottom_widget_text'))) {
- $footer_bottom_widget_text = options::get_value('colors', 'footer_bottom_widget_text');
- } else {
- $footer_bottom_widget_text = '';
- }
- if (strlen(options::get_value('colors', 'links_color'))) {
- $links_color = options::get_value('colors', 'links_color');
- } else {
- $links_color = '';
- }
- if (strlen(options::get_value('colors', 'borders_color'))) {
- $borders_color = options::get_value('colors', 'borders_color');
- } else {
- $borders_color = '';
- }
- if (strlen(options::get_value('colors', 'borders_color'))) {
- $menu_links_hover_color = options::get_value('colors', 'menu_links_hover_color');
- } else {
- $menu_links_hover_color = '';
- }
- if (strlen(options::get_value('colors', 'submenu_hover'))) {
- $submenu_hover = options::get_value('colors', 'submenu_hover');
- } else {
- $submenu_hover = '';
- }
- ?>
- <style type="text/css">
- .crowd-header-over .sticky-holder:not(.fixed) .primary-navigation .nav-menu>li>a{
- color:<?php echo options::get_value('colors', 'slideshow_menu_links_color');?>
- }
- .crowd-layout .sticky-holder:not(.fixed) .primary-navigation > ul > li > a:hover{
- color:<?php echo options::get_value('colors', 'slideshow_menu_links_hover_color'); ?>
- }
- .primary-navigation ul li a:hover, .mobile-menu-inner ul li a:hover{
- color:<?php echo $submenu_hover;?>
- }
- .primary-navigation > ul > li > a:hover, .mobile-menu-inner > ul > li > a:hover{
- color:<?php echo $menu_links_hover_color;?>
- }
- .primary-navigation ul li a, .mobile-menu-inner li a, .menu-toggle i:before, .menu-toggle span{
- color:<?php echo $menu_links_color;?>
- }
- .primary-navigation ul li ul, .crowd-full-screen .children{
- background: <?php echo $submenu_background;?>
- }
- .site-header, body, .primary-navigation ul, .post-pagination .next-post .inner, .post-pagination .prev-post .inner,
- .crowd-layout .site-main,.crowd-layout .site-footer{
- background: <?php echo $background_color?>;
- }
- body, .post-title, .widget-title{
- color: <?php echo $content_text_color;?>;
- }
- .post-title .post-title-before{
- color: <?php echo $pretitle_color;?>
- }
- .post-title .post-title-after{
- color: <?php echo $subtitle_color;?>
- }
- .post-meta span a, .meta-wrap a, .meta-wrap:before, .pagination-wrapper .page-item, .pagination-wrapper .prev, .pagination-wrapper .next {
- color: <?php echo $meta_share_pagination;?>
- }
- .widget_socialicons .social a,.content .social a{
- color: <?php echo options::get_value('colors', 'social_icons_widget_color'); ?>;
- }
- .widget-title{
- color: <?php echo options::get_value('colors', 'widgets_title_color'); ?>;
- }
- .widget, .widget a{
- color: <?php echo options::get_value('colors', 'widgets_content_color'); ?>;
- }
- .footer-bottom{
- background: <?php echo $bottom_widget_background;?>
- }
- .footer-bottom, .footer-bottom a{
- color: <?php echo $footer_bottom_widget_text;?>
- }
- a{
- color: <?php echo $links_color;?>
- }
- .layout-width:before, .single-layout-width:before{
- border-top: 1px solid <?php echo $borders_color;?>;
- }
- .footer-top-inner{
- border-top: 1px solid <?php echo $borders_color;?>;
- border-bottom: 1px solid <?php echo $borders_color;?>;
- }
- <?php if(isset($margin_below_sliders) && $margin_below_sliders != ''):?>
- @media only screen and (min-width: 48.063em) {
- .full-width-slider .flo-slick-slider{
- margin-bottom: <?php echo $margin_below_sliders;?>px;
- }
- }
- <?php endif;?>
- </style>
- <?php
- }
- }
- /**
- * @return array - registered social profiles
- */
- function flo_get_available_social_services()
- {
- $available_social_services = array();
- $social_profiles = get_option('_social');
- if (sizeof($social_profiles) && is_array($social_profiles)) {
- foreach ($social_profiles as $key => $s_profile) {
- if (strlen($s_profile['title'])) {
- $available_social_services[$s_profile['title']] = $s_profile['title'];
- }
- }
- }
- return $available_social_services;
- }
- function addhttp($url) {
- if (!preg_match("~^(?:f|ht)tps?://~i", $url) && (strtolower(substr($url, 0, 7)) != 'mailto:')) {
- $url = "http://" . $url;
- }
- return $url;
- }
- if (!function_exists('flo_set_typography')) {
- /**
- * returns the typography styles based on passed settings
- *
- * @param array $typography_settings - the array of settings. The keys are the same as the typography options name, and the value are elemets to which the fonts must be applied
- * @return string
- */
- function flo_set_typography($typography_settings = array())
- {
- $typography_styles = '';
- if (is_array($typography_settings) && sizeof($typography_settings)) {
- $default_system_fonts = array(
- "Cantarell, Tahoma, Verdana, Helvetica, sans-serif",
- "'Unica One', Arial, Helvetica, sans-serif",
- //"'Montserrat Subrayada', Arial, Helvetica, sans-serif",
- 'Arial, Helvetica, sans-serif',
- 'Times, Georgia, serif',
- 'Verdana, Tahoma, sans-serif',
- "'Century Gothic', Helvetica, Arial, sans-serif",
- 'Helvetica, Arial, sans-serif',
- 'Georgia, Times, serif',
- "'Lucida Grande', 'Lucida Sans Unicode', Tahoma, Verdana, sans-serif",
- 'Palatino, Georgia, serif',
- 'Tahoma, Verdana, Helvetica, sans-serif',
- 'Garamond, Palatino, Georgia, serif',
- 'Courier, monospace',
- "'Trebuchet MS', Tahoma, Helvetica, sans-serif",
- "'Comic Sans MS', Arial, sans-serif",
- 'Bookman, Palatino, Georgia, serif'
- );
- foreach ($typography_settings as $typography_option => $markup_elements) {
- if (strlen(options::get_value('typography', $typography_option . '_font_size'))) {
- $font_size = ' font-size:' . options::get_value('typography', $typography_option . '_font_size') . 'px; ';
- } else {
- $font_size = '';
- }
- if (strlen(options::get_value('typography', $typography_option . '_font_letter_spacing')) && is_numeric(options::get_value('typography', $typography_option . '_font_letter_spacing'))) {
- $letter_spacing = ' letter-spacing:' . options::get_value('typography', $typography_option . '_font_letter_spacing') . 'px; ';
- } else {
- $letter_spacing = '';
- }
- if (strlen( trim(options::get_value('typography', $typography_option . '_font_family')) )) {
- $font_fam_option = options::get_value('typography', $typography_option . '_font_family');
- // usually we have this case when the fonts are loaded usin API KEY and we have several versions of the
- // same font and font name is devided by font style by '|' i.e Acme | italic
- if (strstr($font_fam_option, '|') !== false) {
- $family_exploded = explode('|', $font_fam_option);
- $font_family_value = trim($family_exploded[0]);
- if (!in_array($font_family_value, $default_system_fonts)) {
- // IF the current font is one of the default system fonts, then we will use them without \" (quotes)
- $font_family_value = '"' . $font_family_value . '"';
- }
- $font_family = ' font-family: ' . $font_family_value . ' ; ';
- } else {
- $font_family_value = str_replace('+', ' ', rtrim(options::get_value('typography', $typography_option . '_font_family'), '&v1'));
- if (!in_array($font_family_value, $default_system_fonts)) {
- // IF the current font is one of the default system fonts, then we will use them without \" (quotes)
- $font_family_value = '"' . $font_family_value . '"';
- }
- $font_family = ' font-family: ' . $font_family_value . ' ; ';
- }
- } else {
- $font_family = '';
- }
- if (strlen(options::get_value('typography', $typography_option . '_font_weight'))) {
- $font_weight = ' font-weight:' . options::get_value('typography', $typography_option . '_font_weight') . '; ';
- } else {
- $font_weight = '';
- }
- if (strlen(options::get_value('typography', $typography_option . '_font_style'))) {
- $font_style = ' font-style:' . options::get_value('typography', $typography_option . '_font_style') . '; ';
- } else {
- $font_style = '';
- }
- $typography_styles .= ' ' . $markup_elements . '{ ' . $font_size . $font_family . $font_weight . $font_style . $letter_spacing . '}' . ' ';
- }
- }
- /* Start Option for mobile devices*/
- $typography_styles .= '@media only screen and (max-width: 768px) {';
- foreach ($typography_settings as $typography_option => $markup_elements) {
- if (strlen(options::get_value('typography', $typography_option . '_font_size_mobile'))) {
- $font_size = ' font-size:' . options::get_value('typography', $typography_option . '_font_size_mobile') . 'px; ';
- } else {
- $font_size = '';
- }
- if (strlen(options::get_value('typography', $typography_option . '_font_letter_spacing_mobile')) && is_numeric(options::get_value('typography', $typography_option . '_font_letter_spacing_mobile'))) {
- $letter_spacing_mobile = ' letter-spacing:' . options::get_value('typography', $typography_option . '_font_letter_spacing_mobile') . 'px; ';
- } else {
- $letter_spacing_mobile = '';
- }
- $typography_styles .= ' ' . $markup_elements . '{ ' . $font_size . $letter_spacing_mobile .'}' . ' ';
- }
- $typography_styles .= '}';
- /* End Option for mobile devices*/
- return $typography_styles;
- }
- }
- /**
- * render social icons
- */
- if (!function_exists('flo_get_social_icons')) {
- function flo_get_social_icons($enabled_services = array('facebook', 'twitter', 'gplus', 'yahoo', 'dribbble', 'linkedin', 'vimeo', 'youtube', 'tumblr', 'delicious', 'flickr', 'instagram', 'pinterest', 'skype', 'email',
- 'rss'), $no_icons = false, $add_search = false)
- {
- if (!(is_array($enabled_services) && sizeof($enabled_services))) {
- $enabled_services = array();
- }
- // the following social profiles have font icons support
- $default_supported_profiles = array('facebook', 'twitter', 'gplus', 'yahoo', 'dribbble', 'linkedin', 'vimeo', 'youtube', 'tumblr', 'delicious', 'flickr', 'instagram', 'pinterest', 'skype', 'email', 'rss');
- $social_profiles = get_option('_social');
- ob_start();
- ob_clean();
- $social_icons_content = '';
- if (!$no_icons && sizeof($social_profiles) && is_array($social_profiles)) {
- //deb::e($social_profiles);
- foreach ($social_profiles as $key => $s_profile) {
- //if(isset($s_profile['title']) && in_array( trim($s_profile['title']), $enabled_services) ){
- // backwards compatibility
- $profile_url = $s_profile['url'];
- if (in_array(trim($s_profile['title']), $enabled_services)) {
- if (isset($s_profile['icon_image'])) {
- $icon_img_src = $s_profile['icon_image'];
- } else {
- $icon_img_src = '';
- }
- switch (trim($s_profile['title'])) {
- case 'facebook':
- // backward compatibility: if user entered just FB profile name, we will built the real URL below
- if (!cosmo_isValidURL($profile_url) && strlen($profile_url)) {
- $profile_url = 'http://facebook.com/people/@/' . $profile_url;
- }
- break;
- case 'twitter':
- // backward compatibility: if user entered just Twitter profile name, we will built the real URL below
- if (!cosmo_isValidURL($profile_url) && strlen($profile_url)) {
- $profile_url = 'http://twitter.com/' . $profile_url;
- }
- break;
- }
- if (!isset($s_profile['icon_image']) || (isset($s_profile['icon_image']) && trim($s_profile['icon_image']) == '')
- && isset($s_profile['title']) && in_array(trim(strtolower($s_profile['title'])), $default_supported_profiles)
- ) {
- // use font icons for suported services if customicon is not uploaded
- $icon = '<i class="icon-' . trim(strtolower($s_profile['title'])) . '"></i>';
- } else if (isset($s_profile['icon_image_hover']) && strlen($s_profile['icon_image_hover'])) {
- // for icons that have image for rol over we add a specific class "flo-social-hover" and data atributes for hove and original image.
- $icon = '<i><img src="' . $icon_img_src . '" data-imghover="' . $s_profile['icon_image_hover'] . '" data-imgoriginal="' . $icon_img_src . '" alt="' . $s_profile['title'] . '" class="flo-social-hover" /></i>';
- } else {
- $icon = '<i><img src="' . $icon_img_src . '" alt="' . $s_profile['title'] . '" /></i>';
- }
- if (strlen(trim($profile_url))) {
- ?>
- <a href="<?php echo addhttp($profile_url) ?>" target="_blank" class="<?php echo $s_profile['title']; ?> hover-menu"><?php echo $icon; ?></a>
- <?php
- }
- }
- }
- }
- $social_icons_content = ob_get_clean();
- if ($add_search) { // append search
- $social_icons_content .= '<a href="javascript:void(0);" class="the-header-search"> <i class="icon-search"></i> </a>';
- }
- if (strlen(trim($social_icons_content))) {
- ?>
- <div class="social-links">
- <div class="social">
- <?php echo $social_icons_content; ?>
- </div>
- </div>
- <?php
- if ($add_search) { // append search
- ?>
- <div class="header-serch">
- <form action="<?php echo home_url(); ?>/" method="get" id="searchform-header">
- <fieldset>
- <input class="input" name="s" type="text" id="keywords1" value="" placeholder="search">
- <button><i class="icon-search"></i></button>
- <i class="icon-close"></i>
- </fieldset>
- </form>
- </div>
- <?php
- }
- }
- }
- }
- /*
- * List Blog view width
- * Single blog post width
- */
- if (!function_exists('cosmo_get_post_list_width')) {
- function cosmo_get_post_list_width($args)
- {
- $single_blog_post_max_width = options::get_value('layout', 'single_blog_post_max_width');
- ?>
- <style type="text/css">
- <?php if(is_numeric($single_blog_post_max_width)){?>
- .post-article .post-article-inner
- {
- max-width: <?php echo $single_blog_post_max_width."px";?>;
- }
- <?php }?>
- <?php
- // for the submenu use font with 1 pixels smaller
- $navigation_font_size = options::get_value( 'typography' , 'menu_links_font_font_size' );
- $submenu_nav_font_size = $navigation_font_size - 1;
- ?>
- @media screen and (min-width: 768px) {
- .main-navigation .menu ul.children a{ font-size: <?php echo $submenu_nav_font_size; ?>px ; }
- }
- </style>
- <?php }
- } ?>
- <?php /**
- * render attached images gallery
- */
- if (!function_exists('cosmo_get_post_img_slideshow')) {
- function cosmo_get_post_img_slideshow($args)
- {
- extract($args); // extract passed arguments
- // add any new arguments here
- $default_args = array(
- 'post_id' => 0,
- 'size' => array('width' => 750, 'height' => 500),
- 'show_nav_thumbs' => true,
- 'main_container_class' => 'royalSlider',
- 'slide_class' => ''
- );
- foreach ($args as $entry_key => $entry_value) {
- $default_args[$entry_key] = $entry_value;
- }
- extract($default_args);
- /*check the meta data where the attached image ids are stored*/
- if (metadata_exists('post', $post_id, '_post_image_gallery')) {
- $product_image_gallery = get_post_meta($post_id, '_post_image_gallery', true);
- $img_id_array = array_filter(explode(',', $product_image_gallery));
- }
- if (isset($img_id_array) && is_array($img_id_array)) {
- foreach ($img_id_array as $value) {
- $attachments[$value] = $value; // create attachments array in hte format that will work for us
- }
- }
- if (isset($attachments) && count($attachments) > 0) {
- $pretty_colection_id = mt_rand(0, 9999);
- $counter = 0; ?>
- <div class=" single-post-gallery not-main-slideshow rsDefault <?php if (isset($main_container_class)) {
- echo $main_container_class;
- }
- if (!$show_nav_thumbs) {
- echo ' no-thumbs ';
- } ?> " style=" height:<?php echo $size['height']; // we need to set this height to have the slider size as we want ?>px; ">
- <?php
- foreach ($attachments as $att_id => $attachment) {
- ?>
- <div class="rsContent <?php if (isset($slide_class)) {
- echo $slide_class;
- } ?> ">
- <div class="img-holder">
- <?php
- $full_img_url = wp_get_attachment_url($att_id);
- $thumbnail_url = aq_resize($full_img_url, $size['width'], $size['height'], false, false); //resize img, Return an array containing url, width, and height.
- $src = $thumbnail_url[0]; // use original img src
- ?>
- <!-- lazy load img -->
- <a class="rsImg" href="<?php echo $src; ?>" data-rsBigImg="<?php echo $full_img_url; ?>"></a>
- <?php if ($show_nav_thumbs) { ?>
- <?php
- $thumbnail_url = aq_resize($full_img_url, 150, 150, true, false); //crop img,
- ?>
- <div class="rsTmb"><img src="<?php echo $thumbnail_url[0]; ?>" width="<?php echo $thumbnail_url[1];?>" height="<?php echo $thumbnail_url[2];?>" alt=""/></div>
- <?php } ?>
- </div>
- </div>
- <?php } ?>
- </div>
- <?php
- }
- }
- }
- /**
- * params:
- * int - $post_id - the ID of the post for which we wsant to retrieve the categories
- * bool - $only_first_cat - return only first categ or all of them
- * string - $taxonomy - the name of the wanted taxonomy, 'category' by default , other values may be 'post_tag' for standard posts or something ele for custom posts
- * string - $margin_elem_start - it shuld be a html element that will show up before each category
- * string - $margin_elem_end - it shuld be a html element that will show up after each category
- * string - $delimiter - the string between the taxonomies
- * string - $a_class - the class that is used for the anchor that surrounds the taxonomies
- * string - $no_link - use or not links around the taxonomies
- */
- if (!function_exists('flo_get_post_taxonomies')) {
- function flo_get_post_taxonomies($post_id, $only_first_cat = false, $taxonomy = 'category', $margin_elem_start = '', $margin_elem_end = '', $delimiter = ', ', $a_class = '', $no_link = false)
- {
- $cat = '';
- $categories = wp_get_post_terms($post_id, $taxonomy);
- if (!empty($categories)) {
- $ind = 1;
- foreach ($categories as $category) {
- $categ = get_term($category->term_id, $taxonomy);
- if ($ind != count($categories) && !$only_first_cat) {
- $cat_delimiter = $delimiter;
- } else {
- $cat_delimiter = '';
- }
- if ($no_link) {
- $cat .= $margin_elem_start . $categ->name . $cat_delimiter . $margin_elem_end;
- } else {
- $cat .= $margin_elem_start . '<a href="' . get_category_link($category) . '" class="' . $a_class . '">' . $categ->name . $cat_delimiter . '</a>' . $margin_elem_end;
- }
- if ($only_first_cat) {
- break;
- }
- $ind++;
- }
- //$cat = __('in','flotheme').' '. $cat;
- }
- return $cat . ' ';
- }
- }
- /**
- * render a link to the post's post format archive, the link has a specific class depending on hte post format
- * params:
- * int - $post_id - the ID of the post for which we want to retrieve the post format
- */
- if (!function_exists('cosmo_get_post_format_link')) {
- function cosmo_get_post_format_link($post_id)
- {
- $result = '';
- $format = get_post_format($post_id);
- $format_link = get_post_format_link($format);
- if (!strlen($format_link)) {
- $format_link = "javascript:void(0);";
- }
- switch ($format) {
- case 'video':
- $result .= '<a class="entry-format" href="' . $format_link . '"><i class="icon-video"></i></a>';
- break;
- case 'image':
- $result .= '<a class="entry-format" href="' . $format_link . '"><i class="icon-image"></i></a>';
- break;
- case 'audio':
- $result .= '<a class="entry-format" href="' . $format_link . '"><i class="icon-audio"></i></a>';
- break;
- case 'link':
- $result .= '<a class="entry-format" href="' . $format_link . '"><i class="icon-attachment"></i></a>';
- break;
- case 'gallery':
- $result .= '<a class="entry-format" href="' . $format_link . '"><i class="icon-gallery"></i></a>';
- break;
- case 'quote':
- $result .= '<a class="entry-format" href="' . $format_link . '"><i class="icon-quote"></i></a>';
- break;
- default:
- $result .= '<a class="entry-format" href="' . $format_link . '"><i class="icon-standard"></i></a>';
- break;
- }
- return $result;
- }
- }
- /**
- * retrieves the post date in the format specified in the theme settings
- * params:
- * int - $post_id - the ID of the post for which we want to retrieve the post format
- */
- if (!function_exists('flo_get_post_date')) {
- function flo_get_post_date($post_id)
- {
- if (options::logic('blog_post', 'time')) {
- $post_date = human_time_diff(get_the_time('U', $post_id), current_time('timestamp')) . ' ' . __('ago', 'flotheme');
- } else {
- $post_date = date_i18n(get_option('date_format'), get_the_time('U', $post_id));
- }
- return $post_date . ' ';
- }
- }
- /**
- * check if a given string is a valid URL
- */
- //if ( ! function_exists( 'cosmo_isValidURL' ) ) {
- function cosmo_isValidURL($url)
- {
- return preg_match('|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $url);
- }
- //}
- /**
- * render post meta
- */
- if (!function_exists('cosmo_post_meta')) {
- function cosmo_post_meta($post)
- {
- global $wp_query;
- ?>
- <div class="post-meta-container">
- <ul class="post-meta">
- <li><?php echo cosmo_get_post_date($post->ID); ?></li>
- <li><a href="<?php echo get_author_posts_url($post->post_author) ?>">
- <?php echo get_the_author_meta('display_name', $post->post_author); ?>
- </a>
- </li>
- <?php
- if (comments_open($post->ID)) {
- $comments_label = __('comments', 'flotheme');
- if (options::logic('blog_post', 'fb_comments')) {
- ?>
- <li class="meta-elem cosmo-comments" title=""><a href="<?php echo get_comments_link($post->ID); ?>">
- <fb:comments-count href="<?php echo get_permalink($post->ID) ?>"></fb:comments-count> <?php echo $comments_label; ?></a></li><?php
- } else {
- if (get_comments_number($post->ID) == 1) {
- $comments_label = __('comment', 'flotheme');
- }
- ?>
- <li class="meta-elem cosmo-comments" title="<?php echo get_comments_number($post->ID);
- echo ' ' . $comments_label; ?>"><a href="<?php echo get_comments_link($post->ID) ?>"> <?php echo get_comments_number($post->ID) . ' ' . $comments_label ?> </a></li><?php
- }
- }
- ?>
- <?php if (!is_page()) { ?>
- <?php
- $tags = wp_get_post_terms($post->ID, 'post_tag');
- if (!empty($tags)) {
- ?>
- <li class="meta-elem">
- <i class="icon-tag"></i>
- <ul class="b_tag">
- <?php
- echo flo_get_post_taxonomies($post->ID, $only_first_cat = false, $taxonomy = 'post_tag', $margin_elem_start = '<li>', $margin_elem_end = '</li> ', $delimiter = ',');
- ?>
- </ul>
- </li>
- <?php } ?>
- <li class="meta-elem">
- <?php
- $categories = wp_get_post_terms($post->ID, 'category');
- if (!empty($categories)) {
- ?>
- <i class="icon-category"></i>
- <ul class="category">
- <?php
- echo flo_get_post_taxonomies($post->ID, $only_first_cat = false, $taxonomy = 'category', $margin_elem_start = '<li>', $margin_elem_end = '</li> ', $delimiter = ',');
- ?>
- </ul>
- <?php
- }
- ?>
- </li>
- <?php } ?>
- </ul>
- </div>
- <?php
- }
- }
- /**
- * Cosmo loop
- */
- if (!function_exists('cosmo_loop')) {
- function cosmo_loop($template, $column_class = 'small-12 large-9 columns', $side = '')
- {
- global $wp_query, $massonry_class, $taxonomy, $post, $custom_query, $page_id, $i,$nr_cols,$count_posts,$the_query,$last;
- $custom_query = $wp_query;
- $the_query = $wp_query;
- // echo "<pre>";
- // var_dump($wp_query);die;
- $enable_massonry = false;
- $i = 0;
- if ($template == 'blog_page') {
- $view_type = options::get_value('content_settings', 'blog_listing_layout');
- $grid_cols = options::get_value('content_settings', 'blog_grid_layout');
- } else {
- $view_type = options::get_value('content_settings', 'archive_listing_layout');
- $grid_cols = options::get_value('content_settings', 'archive_grid_layout');
- }
- global $grid_class, $view_type_custom, $block_width;
- // set the blog width for grid and thumb view
- if ( strlen(options::get_value('content_settings', 'blog_grid_layout')) != '') {
- if ($grid_cols == 'grid1') {
- $block_width = ' small-12 large-6 ';
- $nr_cols = 2;
- } elseif ($grid_cols == 'grid2') {
- $block_width = ' small-12 large-4 ';
- $nr_cols = 3;
- }elseif ($grid_cols == 'grid3') {
- $block_width = ' small-13 large-3 ';
- $nr_cols = 4;
- }
- } else {
- $block_width = ' small-12 large-3 ';
- $nr_cols = 3;
- }
- // for grid-50_50 view type we will force 2 columns
- if('grid-50_50' == $view_type){
- $nr_cols = 2;
- $block_width = ' small-12 large-6 ';
- }
- $view_type_custom = $view_type;
- if (count($wp_query->posts) > 0) {
- if (strpos($view_type, 'list') !== false) { // if any of the list view
- ?>
- <?php
- foreach ($wp_query->posts as $index => $post) {
- $wp_query->the_post();
- $template_name = 'floshortcodes/cosmo-' . $view_type . '.php'; // in order for this to work properly you should have the templates name having the view type name.
- include(locate_template($template_name));
- }
- get_template_part('pagination');
- ?>
- <?php
- } else {
- if (!(isset($gutter_class) && strlen($gutter_class))) {
- $gutter_class = 'no-gutter';
- }
- ?>
- <?php
- $massonry_class = '';
- $enable_massonry = true;
- $i = 1;
- $counter = 1;
- $count_posts = count($wp_query->posts);
- foreach ($wp_query->posts as $index => $post) {
- $wp_query->the_post();
- if($post->post_type == 'video'){
- $taxonomy = 'video-category';
- }elseif($post->post_type == 'gallery'){
- $taxonomy = 'gallery-category';
- }else{
- $taxonomy = 'category';
- }
- $template_name = 'floshortcodes/' . $view_type . '.php'; // in order for this to work properly you should have the templates name having the view type name.
- include(locate_template($template_name));
- $i++;
- $global_count = get_option('posts_per_page',true);
- $counter++;
- if ($counter == (int)$global_count){
- $last = true;
- }else{
- $last = false;
- }
- }
- ?>
- <!-- --><?php
- get_template_part('pagination');
- // ?>
- <?php
- }
- if ($enable_massonry) {
- wp_localize_script('functions', 'enable_massonry', '1');
- } else {
- wp_localize_script('functions', 'enable_massonry', '0');
- }
- wp_reset_postdata(); /* Restore original Post Data */
- } else {
- get_template_part('loop', '404');
- }
- }
- }
- /**
- * Title : Aqua Resizer
- * Description : this function will return the image size that will be passed to aq_resize function
- *
- *
- * @param string $size_name - (required) the name of the size option, for example 'single_cropped'
- * @param int $width_or_height - (not required) specifyes what demention we want to get, the width or the height of the image (default - width)
- *
- * @return str|array
- *****/
- function get_aqua_size($size_name, $width_or_height = 'width', $option = 'imagesizes')
- {
- $result = options::get_value($option, $size_name . '_' . $width_or_height);
- if (is_numeric(trim($result))) {
- return trim($result);
- } else {
- /*if the option is empty or not numeric for some reason, we return the default*/
- return options::$default[$option][$size_name . '_' . $width_or_height];
- }
- }
- /**
- * Description : this function will return the class name for the blocks depending on the input (number of columns we want to have)
- *
- *
- * @param int $arabic - number of columns we want to have
- *
- * @return str
- *****/
- if (!function_exists('cosmo_columns_arabic_to_chars')) {
- function cosmo_columns_arabic_to_chars($arabic)
- {
- $words_full_width = array(0 => 'small-12 medium-12', 1 => 'small-12 medium-12', 2 => 'small-12 medium-6', 3 => 'small-12 medium-4', 4 => 'small-12 medium-3', 5 => 'small-12 medium-3', 6 => 'small-12 medium-2',
- 7 => 'small-12 medium-2', 8 => 'small-12 medium-12', 9 => 'small-12 medium-12', 10 => 'small-12 medium-12', 11 => 'small-12 medium-12', 12 => 'small-12 medium-12');
- return $words_full_width[$arabic];
- }
- }
- if (!function_exists('hex2rgb')) {
- function hex2rgb($hex)
- {
- $hex = str_replace("#", "", $hex);
- if (strlen($hex) == 3) {
- $r = hexdec(substr($hex, 0, 1) . substr($hex, 0, 1));
- $g = hexdec(substr($hex, 1, 1) . substr($hex, 1, 1));
- $b = hexdec(substr($hex, 2, 1) . substr($hex, 2, 1));
- } else {
- $r = hexdec(substr($hex, 0, 2));
- $g = hexdec(substr($hex, 2, 2));
- $b = hexdec(substr($hex, 4, 2));
- }
- //$rgb = array($r, $g, $b);
- $rgb = $r . ',' . $g . ',' . $b . ', ';
- //return implode(",", $rgb); // returns the rgb values separated by commas
- return $rgb; // returns an array with the rgb values
- }
- }
- /**
- * cosmo_get_post_types_hc
- */
- if (!function_exists('cosmo_get_post_types_hc')) {
- /**
- * Description : this function will return an array of registered custom post types
- *
- * @return array
- *****/
- function cosmo_get_post_types_hc()
- {
- //of course it can be done via get_post_types, but for some reason it return only posts and pages, and no custom posts, and we have to hardcode this shit
- return array('post' => __('Post', 'flotheme'), 'video' => __('Video', 'flotheme'), 'gallery' => __('Gallery', 'flotheme'), 'page' => __('Pages', 'flotheme'));
- }
- }
- if (!function_exists('cosmo_get_prev_next_elem')) {
- /**
- * Description : this function will return the the next and prev siblings of the given element from an string
- *
- * params:
- * $haystack - string of elements separated by comma where we are looking for our values
- * $current_elem - string, the current element for which we need the siblings
- * @return array that contains next and prev elem
- *****/
- function cosmo_get_prev_next_elem($haystack, $current_elem)
- {
- $haystack_array = explode(",", $haystack);
- $current_key = array_search($current_elem, $haystack_array);
- if (isset($haystack_array[$current_key - 1])) {
- $siblings['previous'] = $haystack_array[$current_key - 1];
- } else {
- $siblings['previous'] = 0;
- }
- if (isset($haystack_array[$current_key + 1])) {
- $siblings['next'] = $haystack_array[$current_key + 1];
- } else {
- $siblings['next'] = 0;
- }
- return $siblings;
- }
- }
- if (!function_exists('cosmo_get_distinct_post_terms')) {
- /*
- Returns distinct taxonomies for a given post, or nothig if nothing found.
- */
- function cosmo_get_distinct_post_terms($post_id, $taxonomy, $return_names = false, $filter_type = '')
- {
- $ids = array();
- $names = '';
- $terms = wp_get_post_terms($post_id, $taxonomy);
- if (is_array($terms)) {
- foreach ($terms as $term) {
- if (!in_array($term->term_id, $ids)) {
- $ids[] = $term->term_id;
- $names .= ' ' . $term->slug . '-' . $filter_type . ' ';
- }
- }
- }
- if ($return_names) {
- return $names;
- } else {
- return $ids;
- }
- }
- }
- if (!function_exists('cosmo_get_filters')) {
- /*
- this function returns the filter by taxonomy
- Params:
- $term_ids - and array or term IDs
- $taxonomy - for example 'category' or 'portfolio'
- $filter_type - we need that to have distinct data-value, to not affect other filters
- */
- function cosmo_get_filters($term_slugs, $taxonomy, $filter_type = 'thumbs', $title = '')
- {
- //var_dump($term_slugs, $taxonomy);die;
- $result = '';
- if (is_array($term_slugs) && sizeof($term_slugs)) {
- $result .= $title;
- $result .= '<a href="#filter" data-option-value="*" class="selected">' . __('All', 'flotheme') . '</a>';
- $i = 0;
- foreach ($term_slugs as $term_slug) {
- if ($term_slug != 'all') {
- $i++;
- //$term = get_term( $term_id, $taxonomy );
- $term = get_term_by('slug', $term_slug, $taxonomy);
- // var_dump($term);die;
- $result .= '<a href="' . esc_url(add_query_arg('term', $term_slug) ) . '" data-filter=".' . $term->slug . '">' . $term->name . '</a>';
- }
- }
- }
- return $result;
- }
- }
- if (!function_exists('cosmoSendContact')) {
- function cosmoSendContact()
- {
- if (isset($_POST['action']) && $_POST['action'] == 'cosmoSendContact') {
- $result = array();
- $tomail = $_POST['cosmo-contact-email'];
- $frommail = '';
- if (isset($_POST['cosmo-name']) && strlen($_POST['cosmo-name'])) {
- $name = trim($_POST['cosmo-name']);
- } else {
- $result['contact_name'] = '<p class="text-error">' . __('Error, name is required field. ', 'flotheme') . '</p>';
- $name = '';
- }
- if (isset($_POST['cosmo-email']) && is_email($_POST['cosmo-email'])) {
- $frommail = trim($_POST['cosmo-email']);
- } else {
- $result['contact_email'] = '<p class="text-error">' . __('Error, please enter a valid email address. ', 'flotheme') . '</p>';
- }
- $message = '';
- if (isset($_POST['cosmo-name'])) {
- $message .= __('Contact name: ', 'flotheme') . trim($_POST['cosmo-name']) . "\n";
- }
- if (isset($_POST['cosmo-email'])) {
- $message .= __('Contact email: ', 'flotheme') . trim($_POST['cosmo-email']) . "\n";
- }
- if (isset($_POST['cosmo-phone'])) {
- $message .= __('Contact phone: ', 'flotheme') . trim($_POST['cosmo-phone']) . "\n\n";
- }
- if (isset($_POST['cosmo-subject'])) {
- $message .= __('Subject: ', 'flotheme') . trim($_POST['cosmo-subject']) . "\n\n";
- }
- $message .= trim($_POST['cosmo-message']);
- if (is_email($tomail) && strlen($tomail) && strlen($frommail) && strlen($name) && strlen($message)) {
- // if this option is enabled, then we will use the visitor email in the Form field
- if( options::logic('blog_post', 'contact_page_from_field_source_user_email') ){
- $headers = 'From: '.trim($_POST['cosmo-name']).' <'.trim($_POST['cosmo-email']).'>';
- }else{
- $headers = '';
- }
- $subject = __('New email from', 'flotheme') . ' ' . get_bloginfo('name') . '.' . __(' Sent via contact form.', 'flotheme');
- wp_mail($tomail, $subject, $message, $headers);
- if (isset($_POST['thx_msg']) && strlen(trim($_POST['thx_msg']))) {
- $thx_msg = urldecode($_POST['thx_msg']);
- } else {
- $thx_msg = __('Email was sent successfully ', 'flotheme');
- }
- $result['message'] = '<span class="text-success" >' . $thx_msg . '</span>';
- }
- echo json_encode($result);
- }
- exit();
- }
- }
- if (!function_exists('flo_get_slideshow')) {
- function flo_get_slideshow($slideshow_id)
- {
- global $post;
- if(strpos(get_page_template_slug( $post->ID), 'template-contact-form') == false &&
- strpos(get_page_template_slug( $post->ID), 'template-gallery') == false ){
- global $slideshow;
- $slideshow = meta::get_meta($slideshow_id, '_floslideshow');
- if (!(isset($slideshow) && is_array($slideshow) && count($slideshow))) {
- return;
- }
- if (!empty($slideshow) && is_array($slideshow) ) {
- $page_slyder_info = flo_get_page_slyder_info();
- if(isset($page_slyder_info['slideshow_type']) && $page_slyder_info['slideshow_type'] != 'content_width' ){
- $slider_type = 'full_width'; // will use full-width.php slidehow template
- }else{
- $slider_type = 'content_width';
- }
- // use Royal slider
- get_template_part( '/parts/slideshow/'.$slider_type);
- }
- }
- }
- }
- /**
- * Reset options
- * @return void
- */
- if (!function_exists('cResetOptions')) {
- function cResetOptions()
- {
- $theme_options = options::$menu['flothemes'];
- if (sizeof($theme_options)) {
- foreach ($theme_options as $key => $value) {
- delete_option($key);
- }
- }
- }
- }
- /**
- * get category taxonomy
- * @param int - post_id
- * @return string - category taxony slug for the passed post id
- */
- if (!function_exists('flo_get_categ_tax')) {
- function flo_get_categ_tax($post_id)
- {
- $current_post_type = get_post_type($post_id);
- // category taxonomy array for each post type
- $categ_taxonomies = array('post' => 'category',
- 'video' => 'video-category',
- 'gallery' => 'gallery-category'
- );
- if (isset($categ_taxonomies[$current_post_type])) {
- return $categ_taxonomies[$current_post_type];
- } else {
- return '';
- }
- }
- }
- if (!function_exists('flo_video_embed')) {
- function flo_video_embed()
- { //echo 'qweqweqwe';
- if (isset($_POST['post_id']) && is_numeric($_POST['post_id'])) { // if post ID is passed vide URL
- $embed_meta = get_post_meta($_POST['post_id'], 'cosmoembed', true);
- $result = array();
- if (cosmo_isValidURL($embed_meta['url'])) {
- // for URL
- global $wp_embed;
- $wp_embed->post_ID = $_POST['post_id']; // use this trick to make the video work via ajax :)
- $result['video'] = $wp_embed->run_shortcode('[embed autoplay="1" ]' . trim($embed_meta['url']) . '[/embed]');
- } else {
- // for embeds
- $result['video'] = $embed_meta['url'];
- }
- echo json_encode($result);
- }
- exit();
- }
- }
- if (!function_exists('flo_post_nav')) :
- /**
- * Displays navigation to next/previous post when applicable.
- *
- *
- * @return void
- */
- function flo_post_nav($middle_page_id = 0)
- {
- global $post;
- $previous = (is_attachment()) ? get_post($post->post_parent) : get_adjacent_post(false, '', true);
- $next = (is_attachment()) ? get_post($post->post_parent) : get_adjacent_post(false, '', false);
- $gallery_next_label = options::get_value('labels', 'next_gallery_label');
- $gallery_prev_label = options::get_value('labels', 'prev_gallery_label');
- $post_next_label = options::get_value('labels', 'next_post_label');
- $post_prev_label = options::get_value('labels', 'prev_post_label');
- $video_next_label = options::get_value('labels', 'next_video_label');
- $video_prev_label = options::get_value('labels', 'prev_video_label');
- if ($previous) {
- if ($post->post_type == 'gallery') {
- previous_post_link('%link', _x('<span class="the-text link prev-gallery"><span class="link-separator">/ </span>' . $gallery_prev_label . '</span>', 'Previous post link', 'flotheme'));
- } elseif ($post->post_type == 'video') {
- previous_post_link('%link', _x('<span class="the-text link next">' . $video_prev_label . '</span>', 'Previous post link', 'flotheme'));
- } else {
- previous_post_link('%link', _x('<span class="the-text link next">' . $post_prev_label . '</span>', 'Previous post link', 'flotheme'));
- }
- } else {
- echo '<a href="#" rel="prev"><span></span></a>';
- }
- if ($post->post_type == 'gallery') {
- next_post_link('%link', _x('<span class="the-text link next-gallery"><span class="link-separator">/ </span>' . $gallery_next_label . '</span> ', 'Next post link', 'flotheme'));
- } elseif ($post->post_type == 'video') {
- next_post_link('%link', _x('<span class="the-text link prev">' . $video_next_label . '</span> ', 'Next post link', 'flotheme'));
- } else {
- next_post_link('%link', _x('<span class="the-text link prev">' . $post_next_label . '</span> ', 'Next post link', 'flotheme'));
- }
- ?>
- <?php
- }
- endif;
- /**
- * // returns the gallery type assigned for a given gallery, or the default setting if the given post does not have that setting.
- */
- if (!function_exists('get_posts_gallery_type')) {
- function get_posts_gallery_type($post_id)
- {
- $gallerytype = meta::get_meta($post_id, 'gallerytype');
- if (isset($gallerytype['value']) && strlen($gallerytype['value'])) {
- return $gallerytype['value'];
- } else {
- return options::get_value('content_settings', 'single_gallery_layout');
- }
- }
- }
- /**
- * Include gallery manager
- */
- include_once('attached_images_manager.php');
- // slideshow manager
- include_once('slideshow_attached_images_manager.php');
- /*----------------------------------------------------------------------------------------------------------------------------------------*/
- /* related posts by herarchical taxonomy */
- /* get tax slugs and number of similar posts */
- function similar_query($post_id, $taxonomy, $posts_per_page = 4)
- {
- $the_post_type = get_post_type($post_id);
- if ('video' == $the_post_type) {
- if ($taxonomy == 'post_tag') {
- $taxonomy = 'tag';
- }
- $taxonomy = 'video-' . $taxonomy;
- }
- $topics = wp_get_post_terms($post_id, $taxonomy);
- $terms = array();
- if (!empty($topics)) {
- foreach ($topics as $topic) {
- $term = get_term($topic->term_id, $taxonomy);
- if (isset($term->slug)) {
- array_push($terms, $term->slug);
- }
- }
- }
- if (!empty($terms)) {
- $query = new WP_Query(array(
- 'post_type' => $the_post_type,
- 'post__not_in' => array($post_id),
- 'posts_per_page' => $posts_per_page,
- 'orderby' => 'rand',
- 'ignore_sticky_posts' => 1,
- 'tax_query' => array(
- array(
- 'taxonomy' => $taxonomy,
- 'field' => 'slug',
- 'terms' => $terms,
- )
- )
- ));
- } else {
- $query = array();
- }
- return $query;
- }
- if (!function_exists('flo_set_transparent_header')) {
- function flo_set_transparent_header()
- {
- //deb::e(is_page());
- if ((is_page() || (is_single() && get_post_type() == 'post')) && !wp_is_mobile()) { //only for pages
- global $post;
- $sl_settings = meta::get_meta($post->ID, 'slideshowSettings');
- if ((isset($sl_settings['slideshow_select']) && is_numeric($sl_settings['slideshow_select']) && $sl_settings['slideshow_select'] != '0') ||
- (is_single() && has_post_thumbnail($post->ID) && options::logic('blog_post', 'show_single_featured') && !post_password_required())
- ) {
- ?>
- <?php
- }
- }
- }
- }
- /**
- * gallery shortcode using massonry
- *
- * @param string $output
- * @param array $attr
- *
- * @return string
- */
- function flo_post_gallery($output, $attr)
- {
- global $post, $wp_locale;
- static $instance = 0;
- $instance++;
- if (isset($attr['orderby'])) {
- $attr['orderby'] = sanitize_sql_orderby($attr['orderby']);
- if (!$attr['orderby'])
- unset($attr['orderby']);
- }
- $size = 'large';
- extract(shortcode_atts(array(
- 'order' => 'ASC',
- 'orderby' => 'menu_order ID',
- 'id' => $post->ID,
- 'itemtag' => 'dl',
- 'icontag' => 'dt',
- 'captiontag' => 'dd',
- 'columns' => 3,
- 'size' => $size,
- 'include' => '',
- 'exclude' => ''
- ), $attr));
- $id = intval($id);
- if ('RAND' == $order)
- $orderby = 'none';
- if (!empty($include)) {
- $include = preg_replace('/[^0-9,]+/', '', $include);
- $_attachments = get_posts(array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
- $attachments = array();
- foreach ($_attachments as $key => $val) {
- $attachments[$val->ID] = $_attachments[$key];
- }
- } elseif (!empty($exclude)) {
- $exclude = preg_replace('/[^0-9,]+/', '', $exclude);
- $attachments = get_children(array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
- } else {
- $attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));
- }
- if (empty($attachments))
- return '';
- if (is_feed()) {
- $output = "\n";
- foreach ($attachments as $att_id => $attachment)
- $output .= wp_get_attachment_link($att_id, $size, true) . "\n";
- return $output;
- }
- // check if the massonry is enabled
- if(options::logic( 'content_settings' , 'use_massonry_gallery_shortcode' )){
- $shcode_massonry_class = 'js-masonry';
- }else{
- $shcode_massonry_class = '';
- }
- // if there is only 1 column, then the massonry is disabled
- if($columns == 1){
- $shcode_massonry_class = 1;
- }
- $output = '<section class="flo-gallery-shortcode grid-view grid-masonry gallery-'.$columns.'-columns"><div class="gallery-shortcode-wrap '.$shcode_massonry_class.'">';
- $i = 0;
- $rand_id = mt_rand(1, 1000);
- $block_width = ' ' . cosmo_columns_arabic_to_chars($columns) . ' ';
- foreach ($attachments as $id => $attachment) {
- $image_attributes = wp_get_attachment_image_src($id, 'full');
- if (isset($attachment->post_excerpt) && strlen($attachment->post_excerpt)) {
- $image_caption = $attachment->post_excerpt;
- } else {
- $image_caption = '';
- }
- if (isset($attachment->post_content) && strlen($attachment->post_content)) {
- $image_description = $attachment->post_content;
- } else {
- $image_description = '';
- }
- $src = wp_get_attachment_image_src($id, 'full'); // get full attachment source
- if (isset($src[0])) {
- $src = $src[0];
- } else {
- $src = '';
- }
- if($columns == 1){
- // if the user is using 1 columns, we will crop the images differently
- options::get_value( 'layout' , 'site_width' );
- if(!is_numeric($site_width)){
- $site_width = 1130;
- }
- $img_url = aq_resize($src, $site_width, 9999, $crop = false, $single = true); //resize img , height 400px
- }else{
- $img_url = aq_resize($src, 9999, 900, $crop = false, $single = true); //resize img , height 400px
- }
- // if for some reason it is not possible to resize the image, we will use the original image
- if($img_url == ''){
- $img_url = $src;
- }
- //$link = '<a href="'.$image_attributes[0].'" data-fancybox-group="prettyPhoto['.$rand_id.']" title="'.$image_caption . $image_description.'" >'.wp_get_attachment_image($id, $size, false).'</a>';
- $link = '<div class=" post-preview gallery-shortcode flo-' . $columns . '-columns" ><a href="' . $image_attributes[0] . '" class="no-lazy" data-fancybox-group="prettyPhoto[' . $rand_id . ']" title="' . esc_attr($image_caption) .' '. esc_attr($image_description) . '" ><img src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" data-original="' . $img_url . '" alt="' . $attachment->post_title . '" /></a></div>';
- $output .= $link;
- }
- $output .= "</div></section>\n";
- //enable massonry
- wp_localize_script('functions', 'enable_massonry', '1');
- /* include jquery.fancybox.pack*/
- wp_register_style('fancybox', get_template_directory_uri() . '/js/fancybox/jquery.fancybox.css');
- wp_enqueue_style('fancybox');
- wp_enqueue_script('apps', get_template_directory_uri() . '/js/fancybox/jquery.fancybox.pack.js', array( 'jquery' ),'',true);
- return $output;
- }
- /**
- * render the comments
- */
- function flo_comment($comment, $args, $depth)
- {
- $GLOBALS['comment'] = $comment;
- switch ($comment->comment_type) {
- case '' :
- {
- ?>
- <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">
- <article id="comment-<?php comment_ID(); ?>" class="comment-body">
- <div class="comment-meta">
- <h2 class="comment-author-name"><?php echo get_comment_author_link($comment->comment_ID); ?> <span><?php echo _e('said', 'flotheme') ?>:</span></h2>
- <!-- <span class="comment-period"><?php _e('on', 'flotheme'); ?> <?php printf(__('%1$s %2$s', 'flotheme'), get_comment_date(), get_comment_time()); ?></span> -->
- <div class="reply-wrap">
- <span class="gray reply fr"><?php comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth']))); ?></span>
- </div>
- </div>
- <div class="comment-content-wrap">
- <div class="comment-content">
- <p>
- <?php
- $order = array("\r\n", "\n", "\r");
- $replace = '<br />';
- echo str_replace($order, $replace, get_comment_text());
- ?>
- </p>
- </div>
- <!-- end .comment-content -->
- </div>
- </article>
- <?php
- break;
- }
- case 'pingback' :
- {
- }
- case 'trackback' :
- {
- ?>
- <li class="pingback">
- <p>
- <?php
- _e('Pingback', 'flotheme'); ?> : <?php comment_author_link(); ?><?php edit_comment_link('(' . __('Edit', 'flotheme') . ')', ' ');
- ?>
- </p>
- <?php
- break;
- }
- }
- }
- /* imports dummy content and settings */
- function importDummyData()
- {
- //$import_archive = get_theme_root(PLAYGROUND_TEMPLATE) . '/' . PLAYGROUND_TEMPLATE . '/import-archives/' . implode('#', array($theme_slug, $skin_slug, $homepage_slug)) . '.zip';
- require_once get_template_directory() . '/lib/demo_content/flo-importer/wordpress-importer.php';
- //$tmp_dir = dirname($import_archive) . '/' . uniqid() . md5(time());
- if (isset($_POST['folder'])) {
- $import_dir = $_POST['folder'];
- } else {
- $import_dir = 'export';
- }
- $tmp_dir = get_template_directory() . '/lib/demo_content/' . $import_dir . '/';
- if (class_exists('Flo_Import_Dummy_Data')) {
- $flo_importer = new Flo_Import_Dummy_Data();
- ob_start();
- $result = $flo_importer->install_programatically($tmp_dir);
- $buffer = ob_get_clean();
- if ($result && stripos($buffer, '<p>All done.') !== false) {
- die(json_encode(array('message' => 'All good!', 'code' => 1)));
- } else {
- die(json_encode(array('message' => 'Something went wrong. Please contact administrator', 'code' => -1)));
- }
- } else {
- die(json_encode(array('message' => 'Missing importer class. Please contact administrator.', 'code' => -1)));
- }
- exit();
- }
- if (!function_exists('flo_wpforce_featured')) {
- /* if a post does not have featured image, then we set the first attached image as feat img */
- function flo_wpforce_featured()
- {
- if (options::logic('blog_post', 'auto_feat_img')) {
- global $post;
- $post_types_to_work_with = array('post', 'gallery'); // add more posts here if you want.
- if (isset($post->ID)) {
- $the_post_format = get_post_type($post->ID);
- } else {
- $the_post_format = 'unknown';
- }
- if (in_array($the_post_format, $post_types_to_work_with)) {
- $already_has_thumb = has_post_thumbnail($post->ID);
- if (!$already_has_thumb) {
- $attached_image = get_children("post_parent=$post->ID&post_type=attachment&post_mime_type=image&numberposts=1");
- if ($attached_image) {
- foreach ($attached_image as $attachment_id => $attachment) {
- set_post_thumbnail($post->ID, $attachment_id);
- }
- }
- }
- }
- }
- } //end function
- }
- add_action('the_post', 'flo_wpforce_featured');
- add_action('save_post', 'flo_wpforce_featured');
- add_action('draft_to_publish', 'flo_wpforce_featured');
- add_action('new_to_publish', 'flo_wpforce_featured');
- add_action('pending_to_publish', 'flo_wpforce_featured');
- add_action('future_to_publish', 'flo_wpforce_featured');
- function flo_dashboard_documentation()
- {
- return array("<li class='flo-docs' ><a href='"._FLO_DOCS_."' target='_blank' ><img src='" . get_template_directory_uri() . "/images/documentation_img.jpg' /></a></li>");
- }
- add_filter('dashboard_glance_items', 'flo_dashboard_documentation');
- /**
- * check if a link exists and don’t return a 404 message
- *
- * @params: string - the URL that must be checked
- * @return boolean
- */
- if (!function_exists('flo_maybe_image_exists')) {
- function flo_maybe_image_exists($url)
- {
- // Let's see if we have a cached version of HTTP request
- $cached_request = get_transient(md5($url));
- if (false === $cached_request) {
- $response = wp_remote_get($url);
- // save to transieant to not make requests every time
- set_transient(md5($url), $response, 60 * 60 * 24 * 30); /* save transient for 30 days */
- } else {
- $response = $cached_request;
- }
- if (is_wp_error($response))
- //request can't performed
- return false;
- if (wp_remote_retrieve_response_code($response) == '404') {
- //request succeed and link not found
- return false;
- }
- //request succeed and link exist
- return true;
- }
- }
- // add action for footer credits
- // only if it is not overwritten by a plugin
- if (!has_action('flo_footer_credits')) {
- add_action('flo_footer_credits', 'flo_get_footer_credits', 10);
- }
- /**
- * outputs the footer credits
- *
- * @params: none
- * @return ---
- */
- if (!function_exists('flo_get_footer_credits')) {
- function flo_get_footer_credits()
- {
- echo '<br/><a href="http://flothemes.com/"><img src="'.get_template_directory_uri().'/favicon.ico" /></a>';
- }
- }
- /**
- * check if a given page has sidebar
- *
- * @params: none
- * @return --- bool
- */
- if (!function_exists('flo_has_sidebar')) {
- function flo_has_sidebar(){
- $has_sidebar = false;
- global $post;
- if(is_singular()){
- $layout = meta::get_meta($post -> ID, 'layout');
- $post_type = get_post_type($post -> ID);
- switch ($post_type) {
- case 'page':
- if(isset($layout['type']) ){
- if( 'left' == $layout['type'] || 'right' == $layout['type'] ){
- $has_sidebar = true;
- }
- }else{
- $default_page_layout = options::get_value('layout', 'page');
- if('full' != $default_page_layout){
- $has_sidebar = true;
- }
- }
- break;
- case 'post':
- if(isset($layout['type']) ){
- if( 'left' == $layout['type'] || 'right' == $layout['type'] ){
- $has_sidebar = true;
- }
- }else{
- $default_page_layout = options::get_value('layout', 'single');
- if('full' != $default_page_layout){
- $has_sidebar = true;
- }
- }
- break;
- default:
- break;
- }
- }else{
- if (is_search()) {
- $the_layout = options::get_value('layout', 'search');
- if('full' != $the_layout){
- $has_sidebar = true;
- }
- } elseif (is_tag() || is_tax('video-tag')|| is_tax('gallery-tag')) {
- $the_layout = options::get_value('layout', 'tag');
- if('full' != $the_layout){
- $has_sidebar = true;
- }
- } elseif (is_category()|| is_tax('video-category')|| is_tax('gallery-category') ) {
- $the_layout = options::get_value('layout', 'category');
- if('full' != $the_layout){
- $has_sidebar = true;
- }
- } elseif (is_author()) {
- $the_layout = options::get_value('layout', 'author');
- if('full' != $the_layout){
- $has_sidebar = true;
- }
- } elseif (is_home()) { /*blog page*/
- $the_layout = options::get_value('layout', 'blog_page');
- if('full' != $the_layout){
- $has_sidebar = true;
- }
- } elseif (is_archive()) {
- $the_layout = options::get_value('layout', 'archive');
- if('full' != $the_layout){
- $has_sidebar = true;
- }
- } elseif (is_404()) {
- $the_layout = options::get_value('layout', '404');
- if('full' != $the_layout){
- $has_sidebar = true;
- }
- }
- }
- return $has_sidebar;
- }
- }
- /*Upload image for title decoration */
- function true_include_myuploadscript() {
- // у вас в админке уже должен быть подключен jQuery, если нет - раскомментируйте следующую строку:
- // wp_enqueue_script('jquery');
- // дальше у нас идут скрипты и стили загрузчика изображений WordPress
- if ( ! did_action( 'wp_enqueue_media' ) ) {
- wp_enqueue_media();
- }
- // само собой - меняем admin.js на название своего файла
- wp_enqueue_script( 'myuploadscript', get_template_directory_uri() . '/js/admin.js', array('jquery'), null, false );
- }
- add_action( 'admin_enqueue_scripts', 'true_include_myuploadscript' );
- function true_image_uploader_field( $name, $value = '', $w = 115, $h = 90) {
- $default = get_template_directory_uri() . '/images/no_img.png';
- if( $value ) {
- $image_attributes = wp_get_attachment_image_src( $value, array($w, $h) );
- $src = $image_attributes[0];
- } else {
- $src = $default;
- }
- echo '
- <div>
- <img data-src="' . $default . '" src="' . $src . '" width="' . $w . 'px" height="' . $h . 'px" />
- <div>
- <input type="hidden" name="' . $name . '" id="' . $name . '" value="' . $value . '" />
- <button type="submit" class="upload_image_button button">Upload</button>
- <button type="submit" class="remove_image_button button">×</button>
- </div>
- </div>
- ';
- }
- /*
- * Добавляем метабокс
- */
- function true_meta_boxes_u() {
- $post_types = array('post', 'page');
- add_meta_box('truediv', 'Title decoration image', 'true_print_box_u', 'page', 'side');
- add_meta_box('truediv', 'Title decoration image', 'true_print_box_u', 'post', 'side');
- add_meta_box('truediv', 'Title decoration image', 'true_print_box_u', 'video', 'side');
- add_meta_box('truediv', 'Title decoration image', 'true_print_box_u', 'gallery', 'side');
- }
- add_action( 'admin_menu', 'true_meta_boxes_u' );
- /*
- * Заполняем метабокс
- */
- function true_print_box_u($post) {
- if( function_exists( 'true_image_uploader_field' ) ) {
- true_image_uploader_field( 'uploader_custom', get_post_meta($post->ID, 'uploader_custom',true) );
- }
- }
- /*
- * Сохраняем данные произвольного поля
- */
- function true_save_box_data_u( $post_id ) {
- if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )
- return $post_id;
- if(isset($_POST['uploader_custom'])){
- update_post_meta( $post_id, 'uploader_custom', $_POST['uploader_custom']);
- }
- return $post_id;
- }
- add_action('save_post', 'true_save_box_data_u');
- function true_add_options_page_u() {
- if ( isset( $_GET['page'] ) == 'uplsettings' ) {
- if ( 'save' == isset( $_REQUEST['action'] ) ) {
- if(isset($_REQUEST[ 'uploader_custom' ])){
- update_option('uploader_custom', $_REQUEST[ 'uploader_custom' ]);
- header("Location: ". site_url() ."/wp-admin/options-general.php?page=uplsettings&saved=true");
- die;
- }
- }
- }
- // add_submenu_page('options-general.php','Дополнительные настройки','Настройки','edit_posts', 'uplsettings', 'true_print_options_u');
- }
- function true_print_options_u() {
- if ( isset( $_REQUEST['saved'] ) ){
- echo '<div class="updated"><p>Saved.</p></div>';
- }
- ?><div class="wrap">
- <form method="post">
- <?php
- if( function_exists( 'true_image_uploader_field' ) ) {
- true_image_uploader_field('uploader_custom', get_option('uploader_custom'));
- }
- ?><p class="submit">
- <input name="save" type="submit" class="button-primary" value="Save changes" />
- <input type="hidden" name="action" value="save" />
- </p>
- </form>
- </div><?php
- }
- add_action('admin_menu', 'true_add_options_page_u');
- /* START : Code for register two new metaboxes in the admin panel for all post types*/
- add_action( 'save_post','_save_post' );
- add_action( 'admin_head', '_add_admin_styles' );
- add_action( 'edit_form_top', '_add_before_field');
- add_action( 'edit_form_after_title', '_add_after_field' );
- //
- // function custom_add_meta_boxes() {
- //
- // var_dump($post_types);die;
- // foreach ( $post_types as $post_type ) {
- // add_meta_box( 'wps_subtitle_panel', $post_type , '_add_subtitle_meta_box', $post_type, 'normal', 'high' );
- //
- // }
- // }
- function _add_subtitle_meta_box() {
- global $post;
- if($post->post_type == 'page' || $post->post_type == 'video' || $post->post_type == 'gallery' || $post->post_type == 'post' ){
- echo '<input type="hidden" name="wps_noncename" id="wps_noncename" value="' . wp_create_nonce( 'wp-subtitle' ) . '" />';
- echo '<input type="text" id="wpsubtitle" name="wps_subtitle" value="" style="width:99%;" />';
- // echo apply_filters( 'wps_subtitle_field_description', '', $post );
- }
- }
- function _add_before_field() {
- global $post;
- if($post->post_type == 'page' || $post->post_type == 'video' || $post->post_type == 'gallery' || $post->post_type == 'post'){
- echo '<div id="subtitlediv" class="top" style="margin-right: 300px">';
- echo '<div id="subtitlewrap">';
- echo '<input type="text" id="wpsubtitle" name="wps_before" value="'.get_post_meta($post->ID,'wps_before',true).'" autocomplete="off" />';
- echo '<div class="subtitledescription">'. __('This text is before the title. ( Optional field )','flotheme').'</div>';
- echo '</div>';
- echo '</div>';
- echo '<div class="clear"></div>';
- }
- }
- function _add_after_field() {
- global $post;
- if($post->post_type == 'page' || $post->post_type == 'video' || $post->post_type == 'gallery' || $post->post_type == 'post' ){
- echo '<div id="subtitlediv" class="top with_bottom_margin" style="line-height: 32px;">';
- echo '<div id="subtitlewrap">';
- echo '<input type="text" id="wpsubtitle" name="wps_after" value="'.get_post_meta($post->ID,'wps_after',true).'" autocomplete="off" />';
- echo '<div class="subtitledescription">'. __('This text is after the title. ( Optional field )','flotheme') .'</div>';
- echo '</div>';
- echo '</div>';
- echo '<div class="clear"></div>';
- }
- }
- function _save_post( $post_id ) {
- if ( isset( $_POST['wps_before'] ) ) {
- update_post_meta( $post_id, 'wps_before', $_POST['wps_before'] );
- }
- if ( isset( $_POST['wps_after'] ) ) {
- update_post_meta( $post_id, 'wps_after', $_POST['wps_after'] );
- }
- }
- function _add_admin_styles() {
- ?>
- <style>
- #subtitlediv.top {
- top:5px;
- position: relative;
- }
- #subtitlediv.top #subtitlewrap {
- border: 0;
- padding: 0;
- }
- .with_bottom_margin{
- bottom: 5px;
- }
- #subtitlediv.top #wpsubtitle {
- background-color: #fff;
- font-size: 1.4em;
- line-height: 1em;
- margin: 0;
- outline: 0;
- padding: 3px 8px;
- width: 50%;
- height: 1.7em;
- float: left;
- }
- #subtitlediv.top #wpsubtitle::-webkit-input-placeholder { padding-top: 3px; }
- #subtitlediv.top #wpsubtitle:-moz-placeholder { padding-top: 3px; }
- #subtitlediv.top #wpsubtitle::-moz-placeholder { padding-top: 3px; }
- #subtitlediv.top #wpsubtitle:-ms-input-placeholder { padding-top: 3px; }
- #subtitlediv.top .subtitledescription {
- margin: 5px 10px 0 10px;
- float: left;
- }
- </style>
- <?php
- }
- /* END : Code for register two new metaboxes in the admin panel for all post types*/
- /* START : This is the function for show (if exist )custom titles by Sliva */
- function flo_title($post_id) {
- $new_title = '';
- //if (in_the_loop()){
- $before = get_post_meta($post_id,'wps_before',true);
- $title = get_the_title($post_id);
- $after = get_post_meta($post_id,'wps_after',true);
- if($before){
- $new_title .= '<span class="post-title-before">'.$before.'</span>';
- }
- $new_title .= $title;
- if($after){
- $new_title .= '<span class="post-title-after">'.$after.'</span>';
- }
- //}
- return $new_title;
- }
- /* END : This is the function for show (if exist )custom titles by Sliva */
- /**
- * params:
- * int - $post_id - the ID of the post for which we wsant to retrieve the categories
- * bool - $only_first_cat - return only first categ or all of them
- * string - $taxonomy - the name of the wanted taxonomy, 'category' by default , other values may be 'post_tag' for standard posts or something ele for custom posts
- * string - $margin_elem_start - it shuld be a html element that will show up before each category
- * string - $margin_elem_end - it shuld be a html element that will show up after each category
- * string - $delimiter - the string between the taxonomies
- * string - $a_class - the class that is used for the anchor that surrounds the taxonomies
- * string - $no_link - use or not links around the taxonomies
- */
- if ( ! function_exists( 'cosmo_get_post_taxonomies' ) ) {
- function cosmo_get_post_taxonomies($post_id, $only_first_cat = false, $taxonomy = 'category', $margin_elem_start = '', $margin_elem_end = '', $delimiter = ', ', $a_class = '', $no_link = false){
- $cat = '';
- $categories = wp_get_post_terms($post_id, $taxonomy );
- if (!empty($categories)) {
- $ind = 1;
- foreach ($categories as $category) {
- $categ = get_term( $category->term_id, $taxonomy);
- if($ind != count($categories) && !$only_first_cat){
- $cat_delimiter = $delimiter;
- }else{
- $cat_delimiter = '';
- }
- if($no_link){
- $cat .= $margin_elem_start . $categ->name . $cat_delimiter . $margin_elem_end;
- }else{
- $cat .= $margin_elem_start . '<a href="' . get_category_link($category) . '" class="'.$a_class.'">' . $categ->name . $cat_delimiter . '</a>' . $margin_elem_end;
- }
- if($only_first_cat){
- break;
- }
- $ind ++;
- }
- //$cat = __('in','flotheme').' '. $cat;
- }
- return $cat .' ' ;
- }
- }
- if ( ! function_exists( 'flo_get_mosaic_settings_box' ) ) {
- function flo_get_mosaic_settings_box($number_blocks,$block_class){
- $mosaic_type = $block_class; // we will use the unique block class as mosaic_type name
- // check if the post ID is set in the URL (that eans we are editing a Mosaic post)
- if(isset($_GET['post'])){
- $post_id = $_GET['post'];
- if ( metadata_exists( 'post', $post_id, '_flomosaic' ) ) {
- $_flomosaic = get_post_meta( $post_id, '_flomosaic', true );
- if(isset($_flomosaic[$block_class] )){
- $mosaic_data = $_flomosaic[$block_class]; // the array containing the data for the whole mosaic block
- }else{
- $mosaic_data = array();
- }
- }
- }else{
- $post_id = 0;
- $mosaic_data = array();
- }
- ob_start();
- ob_clean();
- ?>
- <div class="flo-mosaic-blocks <?php echo $block_class; ?>">
- <?php
- for($i=0; $i<$number_blocks; $i++){
- if(isset($mosaic_data[$i])){
- $data = $mosaic_data[$i];
- }else{
- $data = array();
- }
- if(isset($data['image_id']) && is_numeric($data['image_id'])){
- $img_src_obj = wp_get_attachment_image_src( $data['image_id'] , 'medium' );
- $bg_img = ' background-image: url('. $img_src_obj[0] .'); ' ;
- }else{
- $bg_img = '';
- }
- ?>
- <div class="mosaic_block block_<?php echo $i; ?>" id="mosaic_<?php echo $block_class . '_' . $i; ?>" style="<?php echo $bg_img; ?>">
- <div class="flo-mosaic-actions">
- <span class=" dashicons dashicons-edit edit-flo-mosaic " title="<?php _e('Click to edit the block settings','flotheme'); ?>"></span>
- <span class=" dashicons dashicons-upload upload-flo-mosaic " title="<?php _e('Click to upload image','flotheme'); ?>"></span>
- <span class=" dashicons dashicons-no no-flo-mosaic " title="<?php _e('Click to delete the uploaded image','flotheme'); ?>"></span>
- </div>
- <?php
- echo flo_get_mosaic_block_meta($mosaic_type, $data, $post_id , $i) ;
- ?>
- </div>
- <?php
- }
- ?>
- </div>
- <?php
- $result = ob_get_clean();
- return $result;
- }
- }
- /**
- * Helper method for retrieving the slider image metadata.
- *
- * @param int $mosaic_type
- * @param array $data Array of data for the item.
- * @param int $post_id The current post ID.
- * @return string The HTML output for the slider item.
- */
- function flo_get_mosaic_block_meta($mosaic_type, $data, $post_id , $key) {
- ob_start();
- ?>
- <div id="flomosaic-meta-<?php echo $mosaic_type; ?>" class="flomosaic-meta-container" style="display:none;">
- <div class="media-modal wp-core-ui">
- <a class="media-modal-close" href="#"><span class="media-modal-icon"></span></a>
- <div class="media-modal-content">
- <div class="media-frame flomosaic-media-frame wp-core-ui hide-menu hide-router flomosaic-meta-wrap">
- <div class="media-frame-title">
- <h1><?php _e( 'Edit Metadata', 'flotheme' ); ?></h1>
- </div>
- <div class="media-frame-content">
- <div class="attachments-browser">
- <div class="flomosaic-meta attachments">
- <input id="flomosaic-id-<?php echo $mosaic_type; ?>" class="flomosaic-id" type="hidden" name="_flomosaic[<?php echo $mosaic_type; ?>][<?php echo $key; ?>][image_id]" value="<?php echo ( ! empty( $data['image_id'] ) ? esc_attr( $data['image_id'] ) : '' ); ?>" />
- <table id="flomosaic-meta-table-<?php echo $mosaic_type; ?>" class="form-table flomosaic-meta-table" >
- <tbody>
- <tr id="flomosaic-title-box-<?php echo $mosaic_type; ?>" valign="middle">
- <th scope="row"><label for="flomosaic-title-<?php echo $mosaic_type; ?>"><?php _e( 'Image Title', 'flotheme' ); ?></label></th>
- <td>
- <input id="flomosaic-title-<?php echo $mosaic_type; ?>" class="flomosaic-title" type="text" name="_flomosaic[<?php echo $mosaic_type; ?>][<?php echo $key; ?>][title]" value="<?php echo ( ! empty( $data['title'] ) ? esc_attr( $data['title'] ) : '' ); ?>" />
- <p class="description"><?php _e( 'Sets the image title attribute for the image.', 'flotheme' ); ?></p>
- </td>
- </tr>
- <tr id="flomosaic-title-box-<?php echo $mosaic_type; ?>" valign="middle">
- <th scope="row"><label for="flomosaic-title-<?php echo $mosaic_type; ?>"><?php _e( 'Image Description', 'flotheme' ); ?></label></th>
- <td>
- <input id="flomosaic-description-<?php echo $mosaic_type; ?>" class="flomosaic-description" type="text" name="_flomosaic[<?php echo $mosaic_type; ?>][<?php echo $key; ?>][description]" value="<?php echo ( ! empty( $data['description'] ) ? esc_attr( $data['description'] ) : '' ); ?>" />
- <p class="description"><?php _e( 'Add here the image description.', 'flotheme' ); ?></p>
- </td>
- </tr>
- <tr id="flomosaic-link_url-box-<?php echo $mosaic_type; ?>" class="flomosaic-link-cell" valign="middle">
- <th scope="row"><label for="flomosaic-link-<?php echo $mosaic_type; ?>"><?php _e( 'Image & Tile URL', 'flotheme' ); ?></label></th>
- <td>
- <input id="flomosaic-link_url-<?php echo $mosaic_type; ?>" class="flomosaic-link_url" type="text" name="_flomosaic[<?php echo $mosaic_type; ?>][<?php echo $key; ?>][link_url]" value="<?php echo ( ! empty( $data['link_url'] ) ? esc_url( $data['link_url'] ) : '' ); ?>" />
- </td>
- </tr>
- <!-- Text color option -->
- <tr id="flomosaic-text-color-box-<?php echo $mosaic_type; ?>" valign="middle">
- <th scope="row"><label for="flomosaic-text-color-<?php echo $mosaic_type; ?>"><?php _e( 'Text Color', 'flotheme' ); ?></label></th>
- <td>
- <input type="text" name="_flomosaic[<?php echo $mosaic_type; ?>][<?php echo $key; ?>][text_color]" value="<?php echo ( ! empty( $data['text_color'] ) ? esc_attr( $data['text_color'] ) : '' ); ?>" class="generic-meta-color-picker generic-record settings-color-field flo-slideshow-color-picker " />
- <p class="description"><?php _e( 'Title and description text color', 'flotheme' ); ?></p>
- </td>
- </tr>
- <!-- Background color option -->
- <tr id="flomosaic-bg-color-box-<?php echo $mosaic_type; ?>" valign="middle">
- <th scope="row"><label for="flomosaic-bg-color-<?php echo $mosaic_type; ?>"><?php _e( 'Background Color', 'flotheme' ); ?></label></th>
- <td>
- <input type="text" name="_flomosaic[<?php echo $mosaic_type; ?>][<?php echo $key; ?>][bg_color]" value="<?php echo ( ! empty( $data['bg_color'] ) ? esc_attr( $data['bg_color'] ) : '' ); ?>" class="generic-meta-color-picker generic-record settings-color-field flo-slideshow-color-picker " />
- <p class="description"><?php _e( 'Background color. Will be visible only if no image is uploaded to this block.', 'flotheme' ); ?></p>
- </td>
- </tr>
- <?php do_action( 'flomosaic_after_image_meta_settings', $mosaic_type, $data, $post_id, $key ); ?>
- </tbody>
- </table>
- <?php do_action( 'flomosaic_after_image_meta_table', $mosaic_type, $data, $post_id, $key ); ?>
- </div><!-- end .flomosaic-meta -->
- <div class="media-sidebar">
- <div class="flomosaic-meta-sidebar">
- <h3><?php _e( 'Helpful Tips', 'flotheme' ); ?></h3>
- <strong><?php _e( 'Saving and Exiting', 'flotheme' ); ?></strong>
- <p class="no-margin"><?php _e( 'To save the added data, close this modal window and click on Update post button. You can close this window by either clicking on the "X" above or hitting the <code>esc</code> key on your keyboard.', 'flotheme' ); ?></p>
- </div><!-- end .flomosaic-meta-sidebar -->
- </div><!-- end .media-sidebar -->
- </div><!-- end .attachments-browser -->
- </div><!-- end .media-frame-content -->
- </div><!-- end .media-frame -->
- </div><!-- end .media-modal-content -->
- </div><!-- end .media-modal -->
- <div class="media-modal-backdrop"></div>
- </div>
- <?php
- return ob_get_clean();
- }
- add_action('save_post', 'flo_save_mosaic_settings');
- // save attached images meta data
- function flo_save_mosaic_settings($post_id){
- //// GLOBAL $POST
- global $post;
- // Slideshow images Data
- if(isset($_POST['_flomosaic'] )){
- // Sanitize user input.
- $mosaic_data = $_POST['_flomosaic'];
- update_post_meta( $post_id, '_flomosaic', $mosaic_data );
- }
- }
- include('mosaic/mosaic.shortcode.php');
- if (class_exists('Flo_Mosaic')){
- add_shortcode( 'flo_mosaic', 'mosaic__code' );
- }else{
- add_shortcode( 'flo_mosaic', 'mosaic_code' );
- }
- /*
- process the ajax request that sends the distance between header 1 menu elements
- Updates a option with the received data
- */
- // function flo_header_1_menu_items_margin(){
- // if(isset($_POST['header_1_menu_spacing_nonce']) && isset($_POST['menu_items_margin_right']) && strlen($_POST['menu_items_margin_right']) ){
- // // check to see if the submitted nonce matches with the
- // // generated nonce we created earlier
- // if ( ! wp_verify_nonce( $_POST['header_1_menu_spacing_nonce'], 'header_1_menu_spacing_nonce_val' ) ){
- // die ( 'Busted! Wrong Nonce');
- // }
- //
- // // update the option with the value we got
- // update_option( 'header_1_menu_spacing', ( $_POST['menu_items_margin_right'] ) );
- //
- // echo get_option( 'header_1_menu_spacing', true);
- //
- // }
- //
- // exit();
- // }
- /*
- process the ajax request that sends the distance between header 4 menu elements
- Updates the options with the received data
- */
- // function flo_header_4_menu_items_margin(){
- // if(isset($_POST['header_4_menu_spacing_nonce']) && isset($_POST['left_spacing']) && strlen($_POST['left_spacing']) && isset($_POST['right_spacing']) && strlen($_POST['right_spacing']) ){
- // // check to see if the submitted nonce matches with the
- // // generated nonce we created earlier
- // if ( ! wp_verify_nonce( $_POST['header_4_menu_spacing_nonce'], 'header_4_menu_spacing_nonce_val' ) ){
- // die ( 'Busted! Wrong Nonce');
- // }
- //
- // // update the options with the value we recived
- // update_option( 'header_4_menu_left_spacing', ( $_POST['left_spacing'] ) );
- // update_option( 'header_4_menu_right_spacing', ( $_POST['right_spacing'] ) );
- //
- // echo get_option( 'header_4_menu_left_spacing', true) .' & '.get_option( 'header_4_menu_right_spacing', true);
- //
- // }
- //
- // exit();
- // }
- function floTestimonials_insert_dialog_content(){
- /* latest Galleries template settings */
- $testimonial_categories = get_terms('testimonial-category', array(
- 'hide_empty' => 0
- ));
- if(is_array($testimonial_categories) && sizeof($testimonial_categories)){
- $gallery_category_options = array();
- //deb::e($video_categories);
- foreach ($testimonial_categories as $type) {
- $gallery_category_options[$type->slug] = $type->name;
- }
- ?>
- <div>
- <label><?php _e('Setlect testimonials categories:','flotheme'); ?></label> <br/>
- <select name="shcode-testim-categ[]" multiple="multiple" class="generic-record shcode-testim-categ" style="width: 220px; height: 90px;" >
- <?php
- foreach ($gallery_category_options as $key => $value) {
- ?>
- <option value="<?php echo $key; ?>"><?php echo $value; ?></option>
- <?php
- }
- ?>
- </select>
- </div>
- <?php
- }
- ?>
- <div>
- <label><?php _e('Number of testimonials to show:','flotheme'); ?></label> <br/>
- <input type="text" class="digit tesimonial-nr-posts" name="tesimonial-nr-posts" value="" >
- </div>
- <?php
- exit();
- }
- if (!function_exists('flo_testimonials')) {
- function flo_testimonials( $atts, $content = null ) {
- extract(shortcode_atts(array(
- 'categories' => '',
- 'nr_posts' => get_option('posts_per_page')
- ), $atts));
- if(!is_numeric($nr_posts)){
- $nr_posts = get_option('posts_per_page');
- }
- $args = array('post_type' => 'testimonial',
- 'posts_per_page' => $nr_posts
- );
- if(strlen(trim($categories))){
- $categories = explode(',', $categories);
- $args['tax_query'] = array(
- array(
- 'taxonomy' => 'testimonial-category',
- 'field' => 'slug',
- 'terms' => $categories,
- )
- );
- }
- $testimonials = new WP_Query( $args );
- $result = '';
- if ( $testimonials->have_posts() ) {
- $result .= '<div class="testimonials-container ">';
- $result .= '<div class="rsDefault arrow-glyph9">';
- while ( $testimonials->have_posts() ) {
- $testimonials->the_post();
- $tesminonials_info = get_post_meta( $testimonials->post->ID, 'info', true );
- $result .= '<div class="rsContent">';
- $result .= '<h3 class="testimonial-title post-title">'.get_the_title( $testimonials->post->ID).'</h3>';
- $result .= '<div class="testimonial-content">'.get_the_content( $testimonials->post->ID).'</div>';
- $result .= '<div class="testimonial-delimiter"></div>';
- if(isset($tesminonials_info['author'])){
- $result .= '<span class="testimonial-author">'.$tesminonials_info['author'].'</span>';
- }
- if(isset($tesminonials_info['title'])){
- $result .= '<span class="testimonial-author-title">'.$tesminonials_info['title'].'</span>';
- }
- $result .= '</div>';
- }
- wp_reset_query();
- $result .= '</div>';
- $result .= '</div>';
- }else{
- $result .= __('No testimonials were found using the given criteria.','flotheme');
- }
- return $result;
- }
- }
- add_shortcode('flo_testimonials', 'flo_testimonials');
- /**
- * Check if the current post is a Video post and if Lightbox video is enabled
- * we return the link to video instead of the permalink
- *
- *
- * @return string the class that will be added to the article
- */
- if ( ! function_exists( 'maybeGetVideoLightboxlink' ) ) {
- function maybeGetVideoLightboxlink($post){
- if( options::logic( 'content_settings' , 'vide_grid_lightbox' ) && get_post_type( $post ) == 'video'){
- $embed_meta = get_post_meta($post->ID, 'cosmoembed', true);
- if ( isset($embed_meta['url']) && filter_var($embed_meta['url'], FILTER_VALIDATE_URL) !== false ) {
- return $embed_meta['url'];
- }else{
- return get_permalink($post->ID);
- }
- }else{
- return get_permalink($post->ID);
- }
- }
- }
- /**
- * Check if the current post is a Video post and if Lightbox video is enabled
- * we return a specific class
- *
- *
- * @return string the class that will be added to the article
- */
- if ( ! function_exists( 'maybeGetVideoLightboxClass' ) ) {
- function maybeGetVideoLightboxClass($post){
- if(options::logic( 'content_settings' , 'vide_grid_lightbox' ) && get_post_type( $post ) == 'video'){
- $embed_meta = get_post_meta($post->ID, 'cosmoembed', true);
- if ( isset($embed_meta['url']) && filter_var($embed_meta['url'], FILTER_VALIDATE_URL) !== false ) {
- return 'flo-fancybox-media';
- }else{
- return '';
- }
- }else{
- return '';
- }
- }
- }
- /**
- * Check if we are on a page and if the page has a slider assigned.
- * If all that is trye, then return an array with the selected slider options
- *
- *
- * @return array containing the selected slider options
- */
- if ( ! function_exists( 'flo_get_page_slyder_info' ) ) {
- function flo_get_page_slyder_info(){
- global $post;
- $response = array('selected_slider_id' => 0,
- 'slideshow_type' => 'content_width',
- 'menu_position' => 'crowd-header-bottom',
- 'logo_position' => 'middle-center'
- );
- if(is_page()){
- $slideshow_settings = meta::get_meta($post->ID, 'slideshowSettings');
- if (isset($slideshow_settings['slideshow_select']) && $slideshow_settings['slideshow_select'] != 0) {
- $response['selected_slider_id'] = $slideshow_settings['slideshow_select'];
- if(isset($slideshow_settings['slideshow_type'])){
- $response['slideshow_type'] = $slideshow_settings['slideshow_type'];
- }
- if(isset($slideshow_settings['menu_position'])){
- $response['menu_position'] = $slideshow_settings['menu_position'];
- }
- if(isset($slideshow_settings['logo_position'])){
- $response['logo_position'] = $slideshow_settings['logo_position'];
- }
- }
- }
- return $response;
- }
- }
- /**
- * Check if we are on a pge and it has one of the full width slideshowa
- *
- * @return bool
- */
- if ( ! function_exists( 'is_flo_full_slider_width_page' ) ) {
- function is_flo_full_slider_width_page(){
- $page_slyder_info = flo_get_page_slyder_info();
- global $post;
- // if the we have a slideshow on the current page and if it is a full width slideshow
- if($page_slyder_info['selected_slider_id'] > 0 && $page_slyder_info['slideshow_type'] != 'content_width' && (
- strpos(get_page_template_slug( $post->ID), 'template-contact-form') == false &&
- strpos(get_page_template_slug( $post->ID), 'template-gallery') == false
- )){
- return true;
- }
- return false;
- }
- }
- function flo_get_body_slideshow_classes($classes){
- $page_slyder_info = flo_get_page_slyder_info();
- if($page_slyder_info['selected_slider_id'] > 0 && $page_slyder_info['slideshow_type'] != 'content_width'&& (
- strpos(get_page_template_slug( get_the_ID()), 'template-contact-form') == false &&
- strpos(get_page_template_slug( get_the_ID()), 'template-gallery') == false
- )){
- // the following 2 classes are necessary for the paralax effect
- $classes[] = 'crowd-layout';
- $classes[] = 'crowd-mobile-menu';
- // menu position class
- $classes[] = $page_slyder_info['menu_position'];
- // full screen OR full width slideshow
- if($page_slyder_info['slideshow_type'] == 'full_screen'){
- $classes[] = 'crowd-full-screen';
- }else{
- $classes[] = 'crowd-full-width';
- }
- // for menu w/o logo in the same row
- if($page_slyder_info['logo_position'] != 'left' && $page_slyder_info['logo_position'] != 'right' && $page_slyder_info['logo_position'] != 'logo-inside-menu'){
- $classes[] = 'crowd-simple-menu';
- }
- // necessary when the menu has the description
- if(options::logic('header_settings', 'enable_menu_description')){
- $classes[] = 'crowd-double-menu';
- }
- if(options::get_value('sliders', 'enable_paralax') == 'no'){
- $classes[] = 'flo-no-paralax';
- }
- }
- return $classes;
- }
- add_filter( 'body_class', 'flo_get_body_slideshow_classes' );
- // check if it is necessary to load a full width slideshow
- // this is called usually in the header
- function flo_maybe_get_full_width_slideshow(){
- $page_slyder_info = flo_get_page_slyder_info();
- // if the we have a slideshow on the current page and if it is a full width slideshow
- if($page_slyder_info['selected_slider_id'] > 0 && $page_slyder_info['slideshow_type'] != 'content_width'){
- flo_get_slideshow($page_slyder_info['selected_slider_id']);
- }
- }
- if(!function_exists('flo_render_gallery_container')){
- function flo_render_gallery_container($gallery_type){
- switch ($gallery_type) {
- case 'full_width_content':
- # code...
- return array(
- 'start' => '<div class="gallery horizontal-long">',
- 'end' => '</div>'
- );
- break;
- case 'grid':
- if(isset($settings['gallery_grid_gutter'])){
- $grid_gutter = $settings['gallery_grid_gutter'];
- }else{
- $grid_gutter = options::get_value('sliders', 'gallery_grid_gutter');
- }
- return array(
- 'start' => '<section class="grid-view grid-masonry '.$grid_gutter.'" >
- <div class="row js-masonry ">',
- 'end' => ' </div>
- </section>'
- );
- break;
- default:
- //simple_slider
- $arrows_type = options::get_value('sliders','slider_arrows_type', true);
- return array(
- 'start' => '<section id="gallery-slider" class="gallery-slider simple-slider '.$arrows_type.'">
- <div class="royalSlider rsDefaultInv">',
- 'end' => ' </div>
- </section>'
- );
- break;
- }
- }
- }
- if(!function_exists('flo_pp_gallery_types')){
- function flo_pp_gallery_types(){
- $img_path = get_template_directory_uri() . '/lib/images/pattern/';
- $gallery_types = array(
- //'full_with_content' => $img_path.'slider_2.jpg',
- 'visible_arrow' => $img_path.'slider_1.jpg',
- 'grid' => $img_path.'slider_3.jpg'
- );
- return $gallery_types;
- }
- }
- /**
- *
- * Render the gallery slider
- *
- */
- if(!function_exists('flo_render_gallery_images')){
- function flo_render_gallery_images($gallery_type, $images, $before_images = '', $after_images = '', $number_columns){
- $img_id_array = array_filter(explode(',', $images));
- switch ($gallery_type) {
- case 'grid':
- if ($number_columns == 2) {
- $block_width = ' small-12 medium-6 large-6 ';
- } elseif ($number_columns == 3) {
- $block_width = ' small-12 medium-6 large-4 ';
- } elseif ($number_columns == 4) {
- $block_width = ' small-12 medium-6 large-3 ';
- }elseif ($number_columns == 6) {
- $block_width = ' small-12 medium-6 large-2 ';
- }
- echo $before_images;
- if ( count($img_id_array) > 0) {
- $rand_id = mt_rand(1, 1000);
- foreach ($img_id_array as $key => $value) {
- $img_url1 = wp_get_attachment_url($value, 'full'); //get img URL
- $width = options::get_value('imagesizes', 'single_gallery_grid');
- if ( ! ( intval($width) > 10 ) ) $width = 400;
- $img_url = aq_resize($img_url1, $width, 9999, false, false);
- $attachment = get_post($value);
- if (isset($attachment->post_excerpt) && strlen($attachment->post_excerpt)) {
- $image_caption = $attachment->post_excerpt;
- } else {
- $image_caption = '';
- }
- if (isset($attachment->post_content) && strlen($attachment->post_content)) {
- $image_description = $attachment->post_content;
- } else {
- $image_description = '';
- }
- $alt = get_post_meta($value , '_wp_attachment_image_alt', true);
- ?>
- <article <?php echo post_class('columns post-preview title-over '.$block_width)?> >
- <div class="post-preview-inner">
- <a class="post-preview-image" href="<?php echo $img_url1; ?>" data-fancybox-group="prettyPhoto['<?php echo $rand_id; ?>']" title="<?php echo esc_attr($image_caption) .' '. esc_attr($image_description); ?> " >
- <img src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" data-original="<?php echo $img_url[0]; ?>" width="<?php echo $img_url[1];?>" height="<?php echo $img_url[2];?>" class="attachment-post-thumbnail wp-post-image" alt="<?php echo esc_attr($alt); ?>"/>
- </a>
- </div>
- </article>
- <?php
- }
- }
- echo $after_images;
- break;
- default:
- /*simple_slider*/
- echo $before_images;
- if (isset($img_id_array) && count($img_id_array) > 0) {
- $counter = 0;
- foreach ($img_id_array as $key => $value) {
- $img_original_size = wp_get_attachment_metadata( $value );
- $original_height = $img_original_size['height'];
- $img_url = wp_get_attachment_url($value, 'full'); //get img URL
- $size = "single_gallery_desktop";
- // if original image is smaller than retina size then use ratio 1
- $image = aq_resize($img_url, 9999, get_aqua_size($size, 'height'), false, false);
- $attachment_info = get_post($value); //deb::e($attachment_info );
- $caption = $attachment_info->post_excerpt;
- $image_description = $attachment_info->post_content;
- $src = $image[0]; // use original img src for the first image
- $img_class = '';
- $alt_title = get_post_meta($value, '_wp_attachment_image_alt', true);
- ?>
- <!-- First slide with contetn: image and content -->
- <div class="slide">
- <?php if(options::logic('sliders', 'gallery_visible_arrow_pin_btn') ){ ?>
- <a class="pin-button" href="http://www.pinterest.com/pin/create/button/?media=<?php echo $src; ?>" data-pin-do="buttonPin" data-pin-config="above" target="_blank"></a>
- <?php
- } // EOF if gallery_visible_arrow_pin_btn
- if ($counter > 5) { ?>
- <a class="rsImg" href="<?php echo $src; ?>" width="<?php echo $image[1]; ?>"></a>
- <?php }else{?>
- <img class="rsImg" src="<?php echo $src; ?>" width="<?php echo $image[1]; ?>" height="<?php echo $image[2];?>" alt="<?php echo $alt_title;?>">
- <?php }
- $counter++;
- ?>
- </div>
- <?php
- } //EOF FOREACH
- }
- echo $after_images;
- break;
- }
- }
- }
- if(!is_user_logged_in()){
- global $wp_version;
- if ( version_compare( $wp_version, '4.4', '>=' ) ) {
- add_filter('comment_form_fields','flo_crowd_comment_form_fields',50, 1);
- }
- }
- function flo_crowd_comment_form_fields($comment_fields){//deb::e($comment_fields);
- $new_comment_fields = array(
- $comment_fields['author'],
- $comment_fields['email'],
- $comment_fields['url'],
- $comment_fields['comment']
- );
- return $new_comment_fields;
- }
- // Add custom css for the full width sliders containers
- add_action('wp_head', 'flo_get_custom_css_slider_height');
- function flo_get_custom_css_slider_height(){
- $page_slyder_info = flo_get_page_slyder_info();
- // if the we have a slideshow on the current page and if it is a full width slideshow
- if($page_slyder_info['selected_slider_id'] > 0 && $page_slyder_info['slideshow_type'] != 'content_width'){
- $slides_image_size = array('content_width' => 'slideshow',
- 'simple_full_width' => 'slideshowfullwidth',
- 'visible_near_by' => 'slideshowvisiblenearby',
- 'full_screen' => 'slideshowfullscreen',
- 'slick' => 'slideshowvisiblenearby',
- );
- $height_option_name = $slides_image_size[$page_slyder_info['slideshow_type'] ];
- $slider_height = options::get_value('sliders', $height_option_name.'_height');
- if(!is_numeric($slider_height)){
- $slider_height = 500;
- }
- if($page_slyder_info['slideshow_type'] == 'visible_near_by'){
- $nearby_width_option_name = $slides_image_size[$page_slyder_info['slideshow_type'] ].'_width';
- $nearby_width = options::get_value('sliders', $nearby_width_option_name);
- if(!is_numeric($nearby_width)){
- $nearby_width = 400;
- }
- }
- $full_width_slideshow_mobile_height = options::get_value('sliders', 'full_width_slideshow_mobile_height');
- $visible_nearby_gutter = options::get_value('sliders', 'visible_nearby_gutter');
- if(is_numeric($visible_nearby_gutter)){
- $visible_nearby_gutter = $visible_nearby_gutter/2;
- }
- ?>
- <style>
- <?php
- $media = false;
- if(is_numeric($full_width_slideshow_mobile_height)){
- $media = true;
- ?>
- .crowd-full{
- height: <?php echo $full_width_slideshow_mobile_height; ?>px;
- }
- <?php
- } else if ( ! empty($full_width_slideshow_mobile_height) && strpos($full_width_slideshow_mobile_height, 'vh') !== false ) {
- $media = true;
- ?>
- .crowd-full{
- height: <?php echo $full_width_slideshow_mobile_height; ?>;
- }
- <?php
- }
- if ($media) { ?>
- @media only screen and (max-width: 640px) {
- .crowd-full .main-slideshow .royalSlider {
- height: 100% !important;
- }
- .crowd-full .main-slideshow .royalSlider > div {
- height: 100% !important;
- }
- }
- <?php }
- ?>
- @media only screen and (min-width: 641px) {
- .crowd-full-width .crowd-push, .crowd-full-width .crowd-full{
- height: <?php echo $slider_height; ?>px;
- }
- <?php
- if(is_numeric($visible_nearby_gutter)) { ?>
- .crowd-nearby-slider .rsSlide{
- padding: 0 <?php echo $visible_nearby_gutter; ?>px;
- }
- <?php } ?>
- <?php
- $slick_slideshow_height = options::get_value('sliders','slideshowvisiblenearby_height');
- if( is_numeric($slick_slideshow_height) ){
- ?>
- .main-slideshow .flo-slick-slider{
- height: <?php echo $slick_slideshow_height; ?>px;
- }
- <?php
- }
- ?>
- }
- <?php
- if($page_slyder_info['slideshow_type'] == 'visible_near_by'){
- ?>
- .main-slideshow .crowd-nearby-slider{
- max-width: <?php echo $nearby_width ?>px;
- }
- <?php
- }
- ?>
- </style>
- <?php
- }
- }
- // use 'hentry' class only on single blog posts
- function flo_remove_hentry( $classes ) {
- global $post;
- //var_dump(in_array(get_post_type( $post ), array('video','gallery')));
- if ( !(get_post_type( $post ) == 'post' && is_single()) ) {
- $classes = array_diff( $classes, array( 'hentry' ) );
- }
- return $classes;
- }
- add_filter( 'post_class','flo_remove_hentry' );
- // the maximum image width to be included in a srcset attribute will be the image width
- // default is 1600
- if(!function_exists('flo_custom_max_srcset_image_width')){
- function flo_custom_max_srcset_image_width( $max_width, $size_array ) {
- $width = $size_array[0];
- // set the max image width the value of the this image width
- return $width;
- }
- }
- if(!function_exists('flo_disable_max_srcset_image_width')){
- function flo_disable_max_srcset_image_width() {
- return 1;
- }
- }
- ?>
- <?php
- if(!function_exists('flo_create_image_srcset')){
- function flo_create_image_srcset($size_array,$image_meta, $original_img_url, $crop = false){
- $image_width = $image_meta['width'];
- $image_height = $image_meta['height'];
- $srcset = '';
- $srcset_array = array();
- if(is_array($size_array) && sizeof($size_array)){
- foreach ($size_array as $srcset_dimensions) {
- if(isset( $srcset_dimensions['resize_method'])){
- $resize_method = $srcset_dimensions['resize_method'];
- }else{
- $resize_method = 'width_base'; // the default
- }
- if( ($resize_method == 'width_base' && $image_width > $srcset_dimensions['width']) ||
- ($resize_method == 'height_base' && $image_height > $srcset_dimensions['height'])
- ){
- $srcset_img_url = aq_resize($original_img_url, $srcset_dimensions['width'], $srcset_dimensions['height'], $crop, false);
- if(is_array($srcset_img_url) && isset($srcset_img_url[0]) && strlen($srcset_img_url[0])){
- if(isset($srcset_dimensions['srcset_width'])){
- $srcset_width = $srcset_dimensions['srcset_width'];
- if(!strstr($srcset_width,'x')){
- $srcset_width .= 'w';
- }
- }else{
- $srcset_width = $srcset_img_url[1].'w';
- }
- $srcset_array[] = $srcset_img_url[0] .' '.$srcset_width;
- }
- }else if(!in_array($original_img_url .' '.$image_width.'w',$srcset_array)){
- $srcset_array[] = $original_img_url .' '.$image_width.'w';
- }
- }
- //$srcset_array[] = $original_img_url .' '.$image_width.'w';
- }
- if(sizeof($srcset_array)){
- $srcset = implode(', ', $srcset_array);
- }
- return $srcset;
- }
- }
- /**
- *
- * Function that renders the top dashboard link
- * http://i.imgur.com/k7BxRME.png
- */
- if(!function_exists('flo_render_dashboard_top_bar')){
- function flo_render_dashboard_top_bar(){
- ob_start();
- ob_clean();
- ?>
- <div class="flo-dashboard-top">
- <ul>
- <li class="doc"><a href="<?php echo _FLO_DOCS_; ?>" target="_blank"><?php _e('Documentation','flotheme') ?></a></li>
- <!-- <li class="manage"><a href="admin.php?page=_flo_options&tab=16"><?php _e('Manage','flotheme') ?></a></li> -->
- <li class="updated"><a href="admin.php?page=flotheme_updater"><?php _e('Updates','flotheme') ?></a></li>
- <li class="news"><a href="<?php echo _FLO_NEWS_; ?>" target="_blank" ><?php _e('News','flotheme') ?></a></li>
- <li class="support"><a href="<?php echo _FLO_SUPPORT_; ?>" target="_blank"><?php _e('Support','flotheme') ?></a></li>
- </ul>
- </div>
- <?php
- $top_dashboard = ob_get_clean();
- return $top_dashboard;
- }
- }
- /**
- * @since 2.3
- *
- * Previously the tiles for single blog posts and pages were
- * using H2s, and we decided to change them to H1s
- * The following function will update thw H1 typography settings to what
- * was used for H2s to not have visual changes on the site when user
- * updates the theme.
- * Normaly that update should run just once
- *
- */
- add_action('init', 'flo_migrate_h2_to_h1');
- if(!function_exists('flo_migrate_h2_to_h1')){
- function flo_migrate_h2_to_h1(){
- if(!get_option('flo_h1_updated')){
- $ct = wp_get_theme();
- if(isset($ct->version) && $ct->version < 2.4){ // we will run this only till version 2.4
- //deb::e(get_option('typography'));
- $flo_typography = get_option('typography');
- if($flo_typography){ // if the options are defined
- // we want to have H1 using the same font as H2
- //font_font_family
- if(isset($flo_typography['h2_font_font_family'])){
- $flo_typography['h1_font_font_family'] = $flo_typography['h2_font_font_family'];
- }
- //font_font_weight
- if(isset($flo_typography['h2_font_font_weight'])){
- $flo_typography['h1_font_font_weight'] = $flo_typography['h2_font_font_weight'];
- }
- //font_font_style
- if(isset($flo_typography['h2_font_font_style'])){
- $flo_typography['h1_font_font_style'] = $flo_typography['h2_font_font_style'];
- }
- //font_font_size
- if(isset($flo_typography['h2_font_font_size'])){
- $flo_typography['h1_font_font_size'] = $flo_typography['h2_font_font_size'];
- }
- //font_font_size_mobile
- if(isset($flo_typography['h2_font_font_size_mobile'])){
- $flo_typography['h1_font_font_size_mobile'] = $flo_typography['h2_font_font_size_mobile'];
- }
- //font_font_letter_spacing
- if(isset($flo_typography['h2_font_font_letter_spacing'])){
- $flo_typography['h1_font_font_letter_spacing'] = $flo_typography['h2_font_font_letter_spacing'];
- }
- //font_font_letter_spacing_mobile
- if(isset($flo_typography['h2_font_font_letter_spacing_mobile'])){
- $flo_typography['h1_font_font_letter_spacing_mobile'] = $flo_typography['h2_font_font_letter_spacing_mobile'];
- }
- //update the theme h1 options
- update_option('typography',$flo_typography);
- }
- update_option('flo_h1_updated','1');
- }
- }
- }
- }
- /**
- *
- * Try to retrieve the change log from flothemes.com
- * if that is not possible for some reason, we just read the change log file
- * @params string t_n theme name
- */
- if(!function_exists('flo_get_change_log')){
- function flo_get_change_log($t_n = _TN_){
- $transient_name = $t_n.'_change-remote-log';
- //delete_transient($transient_name );
- if ( FALSE == $response = get_transient( $transient_name ) ) {
- $theme_name = strtolower($t_n);
- $url = 'https://flothemes.com/themes/'.$theme_name.'/?change_log=1';
- $args = array(
- 'sslverify' => false,
- );
- $response = wp_remote_get( $url, $args );
- set_transient( $transient_name, $response, 60 * 60 * 24 ); // 1 day
- }
- //for debugging purpuses
- if(isset($_GET['flo_debug_change_log']) && $_GET['flo_debug_change_log'] == 1){
- echo '<pre>';
- var_dump($response);
- echo '</pre>';
- die();
- }
- if (is_wp_error($response) || $response['response']['code'] != '200' || !isset($response['body']) || strpos($response['body'], 'container main-header') ) {
- // in case something went wrong retrieving the log from our server,
- // then we just load if from the change log file available in the theme.
- return flo_get_change_log_from_file();
- }
- $result = $response['body'];
- return $result;
- }
- }
- if(!function_exists('flo_get_change_log_from_file')){
- function flo_get_change_log_from_file(){
- global $wp_filesystem;
- // Initialize the WP filesystem, no more using 'file-put-contents' function
- if (empty($wp_filesystem)) {
- require_once (ABSPATH . '/wp-admin/includes/file.php');
- WP_Filesystem();
- }
- $change_log_abs_file_path = get_stylesheet_directory().'/change-log.txt';
- // read the change log file;
- $change_log_content = $wp_filesystem->get_contents($change_log_abs_file_path);
- return nl2br($change_log_content) ;
- }
- }
- ?>
Add Comment
Please, Sign In to add comment