function zn_add_inline_css() { global $zn_framework; if ($css = get_post_meta(zn_get_the_id(), 'header_margin', true)) { $zn_framework->add_inline_css("#header.transparent_header { margin-top: " . $css . "px }"); } }
function add_inline_css() { $css = get_post_meta(zn_get_the_id(), 'zn_page_custom_css', true); if (!empty($css)) { ZN()->add_inline_css($css); } }
function add_inline_code() { $css = get_post_meta(zn_get_the_id(), 'zn_page_custom_css', true); $js = get_post_meta(zn_get_the_id(), 'zn_page_custom_js', true); if (!empty($css)) { ZN()->add_inline_css($css); } if (!empty($js)) { ZN()->add_inline_js(array('zn_page_custom_js' => $js)); } }
function element() { $title = $this->opt('title') ? $this->opt('title') : get_the_title(zn_get_the_id()); $desc = $this->opt('desc') ? $this->opt('desc') : get_post_meta(zn_get_the_id(), 'zn_page_subtitle', true); $heading = $this->opt('heading', 'h3'); $css_class = ' zn_section_title_el '; $css_class .= $this->opt('style') ? ' ' . $this->opt('style') : ''; $css_class .= $this->opt('cstyle') ? ' ' . $this->opt('cstyle') . ' ' : ''; //$css_class = $this->opt('style') ? $css_class . ' '. $this->opt('style') : $css_class; $underline = $this->opt('use_underline') === 'show' ? true : false; //** Appear animation $appear = $this->opt('appear_animation') ? 'data-appear="fade-in" data-appear-direction="' . $this->opt('appear_animation') . '" data-appear-delay="' . ($this->opt('appear_delay') ? $this->opt('appear_delay') : '0') . '"' : ''; echo zn_get_title($title, $desc, $this->data['uid'] . $css_class, false, $appear, $underline, $heading); }
function zn_get_sidebar_class($type, $sidebar_pos = false) { if (!$sidebar_pos) { $sidebar_pos = get_post_meta(zn_get_the_id(), 'zn_page_layout', true); } if ($sidebar_pos === 'default' || !$sidebar_pos) { $sidebar_data = zget_option($type, 'unlimited_sidebars', false, array('layout' => 'right_sidebar', 'sidebar' => 'defaultsidebar')); $sidebar_pos = $sidebar_data['layout']; } if ($sidebar_pos !== 'no_sidebar') { $sidebar_pos .= ' col-md-9 '; } else { $sidebar_pos = 'col-md-12'; } return $sidebar_pos; }
public static function disable_editor() { $post_id = zn_get_the_id(); update_post_meta($post_id, 'zn_page_builder_status', 'disabled'); }
/** * Display the proper sub-header based on the provided arguments * * @param array $args The list of arguments */ public static function zn_get_subheader($args = array()) { $id = zn_get_the_id(); $defaults = array('headerClass' => 'zn_def_header_style', 'title' => get_the_title($id), 'layout' => zget_option('zn_disable_subheader', 'general_options'), 'def_header_bread' => zget_option('def_header_bread', 'general_options', false, 1), 'def_header_date' => zget_option('def_header_date', 'general_options', false, 1), 'def_header_title' => zget_option('def_header_title', 'general_options', false, 1), 'show_subtitle' => zget_option('def_header_subtitle', 'general_options', false, true), 'extra_css_class' => '', 'bottommask' => zget_option('def_bottom_style', 'general_options', false, 'none'), 'bg_source' => '', 'is_element' => false, 'inherit_head_pad' => true, 'title_heading' => 'h2'); $saved_headers = zget_option('header_generator', 'unlimited_header_options', false, array()); // Combine defaults with the options saved in post meta if (is_singular()) { // if ( is_singular() || is_home() || is_shop() ) { $post_defaults = array(); $title_bar_layout = get_post_meta($id, 'zn_zn_disable_subheader', true); if (!empty($title_bar_layout)) { $post_defaults = array('layout' => $title_bar_layout, 'subtitle' => get_post_meta($id, 'zn_page_subtitle', true)); $saved_title = get_post_meta($id, 'zn_page_title', true); if (!empty($saved_title)) { $post_defaults['title'] = $saved_title; } } // Sub-header style $zn_subheader_style = get_post_meta($id, 'zn_subheader_style', true); if (!empty($zn_subheader_style)) { $post_defaults['headerClass'] = 'uh_' . $zn_subheader_style; } // Get Subheader settings from Unlimited Subheader style foreach ($saved_headers as $header) { if (isset($header['uh_style_name']) && !empty($header['uh_style_name'])) { $header_name = strtolower(str_replace(' ', '_', $header['uh_style_name'])); if ($zn_subheader_style == $header_name) { $defaults['bottommask'] = $header['uh_bottom_style']; } } } $defaults = wp_parse_args($post_defaults, $defaults); } elseif (is_tax() || is_category()) { global $wp_query; $cat = $wp_query->get_queried_object(); if ($cat && isset($cat->term_id)) { $id = $cat->term_id; $ch = get_option('wpk_zn_select_custom_header_' . $id, false); if (!empty($ch)) { if ('zn_def_header_style' != $ch) { $defaults['headerClass'] = 'uh_' . $ch; } // Get Subheader settings from Unlimited Subheader style foreach ($saved_headers as $header) { if (isset($header['uh_style_name']) && !empty($header['uh_style_name'])) { $header_name = strtolower(str_replace(' ', '_', $header['uh_style_name'])); if ($ch == $header_name) { $defaults['bottommask'] = $header['uh_bottom_style']; } } } } } } $args = wp_parse_args($args, $defaults); $args = apply_filters('zn_sub_header', $args); // If the subheader shouldn't be shown if ($args['layout'] == 'yes') { return; } $extra_classes = array(); $bottom_mask = $args['bottommask']; if ($bottom_mask != 'none') { $extra_classes[] = 'maskcontainer--' . $bottom_mask; } $is_element = $args['is_element']; if ($is_element) { $extra_classes[] = 'page-subheader--custom'; } else { $extra_classes[] = 'page-subheader--auto'; } // Inherit heading & padding from Unlimited Subheader styles // Enabled by default for autogenerated pages and via option in Custom Subheader Element $inherit_head_pad = $args['inherit_head_pad']; if ($inherit_head_pad) { $extra_classes[] = 'page-subheader--inherit-hp'; } $extra_classes[] = $args['headerClass']; $extra_classes[] = $args['extra_css_class']; // Get Site Header's Position (relative | absolute) $header_pos = 'psubhead-stheader--absolute'; $headerLayoutStyle = zget_option('zn_header_layout', 'general_options', false, 'style2'); if (zget_option('head_position', 'general_options', false, '1') != 1) { if ($headerLayoutStyle != 'style7') { $header_pos = 'psubhead-stheader--relative'; } } $extra_classes[] = $header_pos; ?> <div id="page_header" class="page-subheader <?php echo implode(' ', $extra_classes); ?> "> <div class="bgback"></div> <?php $bg_source = $args['bg_source']; if (!empty($bg_source) && is_array($bg_source)) { WpkPageHelper::zn_background_source($bg_source); } ?> <div class="th-sparkles"></div> <!-- DEFAULT HEADER STYLE --> <div class="ph-content-wrap"> <div class="ph-content-v-center"> <div> <div class="container"> <div class="row"> <?php $br_date = (int) $args['def_header_bread'] || (int) $args['def_header_date']; $def_cols = $br_date ? 6 : 12; if ($br_date) { ?> <div class="col-sm-6"> <?php if ((int) $args['def_header_bread']) { zn_breadcrumbs(); } else { echo ' '; } if ((int) $args['def_header_date']) { echo '<span id="current-date" class="subheader-currentdate hidden-xs">' . date_i18n(get_option('date_format'), strtotime(date("l M d, Y") . get_option('gmt_offset')), false) . '</span>'; } else { echo ' '; } ?> <div class="clearfix"></div> </div> <?php } ?> <div class="col-sm-<?php echo $def_cols; ?> "> <div class="subheader-titles"> <?php if (!empty($args['def_header_title'])) { ?> <<?php echo $args['title_heading']; ?> class="subheader-maintitle"> <?php echo $args['title']; ?> </<?php echo $args['title_heading']; ?> > <?php } ?> <?php if (isset($args['show_subtitle']) && $args['show_subtitle'] && !empty($args['subtitle'])) { ?> <h4 class="subheader-subtitle"> <?php echo do_shortcode($args['subtitle']); ?> </h4> <?php } ?> </div> </div> </div> <!-- end row --> </div> </div> </div> </div> <?php WpkPageHelper::zn_bottommask_markup($bottom_mask); ?> </div> <?php }
function zn_get_header($args = false) { $post_type = get_post_type(); $id = zn_get_the_id(); $defaults = array('title' => get_the_title($id), 'description' => get_post_meta($id, 'zn_page_subtitle', true), 'class' => zget_option('header_ustyle', 'general_options'), 'heading' => 'h1', 'background' => get_post_meta($id, 'header_media_image', true)); $args = wp_parse_args($args, $defaults); $args = apply_filters('zn_sub_header', $args); extract($args, EXTR_SKIP); if ($background) { $background = 'style=" background-image:url(\'' . $background . '\') "'; } ?> <section class="imageBackground bkg-responsive folioDetailParallax parallax_enabled <?php echo $class; ?> " <?php echo $background; ?> > <div class="container"> <div class="textContainer"> <?php echo '<' . $heading . ' class="bigText">' . $title . '</' . $heading . '>'; echo '<div class="mediumText">' . $description . '</div>'; ?> </div> </div> </section> <?php }
function element() { global $post, $zn_framework; $columns_num = $this->opt('columns_num') ? $this->opt('columns_num') : '3'; $columns_class = zn_get_col_size($columns_num); $underline = $this->opt('use_underline') !== 'zn_dummy_value' ? true : false; $title = $this->opt('title') ? '<span ' . ($underline ? 'class="underline"' : '') . '>' . $this->opt('title') . '</span>' : ''; $title_style = $this->opt('title_style') ? $this->opt('title_style') : ''; //** Appear animation $appear = $this->opt('appear_animation') ? 'data-appear="fade-in" data-appear-direction="' . $this->opt('appear_animation') . '" data-appear-delay="' . ($this->opt('appear_delay') ? $this->opt('appear_delay') : '0') . '"' : ''; $portfolio_items = ''; $tag_ids = wp_get_post_terms(zn_get_the_id(), 'portfolio_tags', array('fields' => 'ids')); if ($tag_ids) { $args = array('post_type' => 'portfolio', 'posts_per_page' => $columns_num, 'post__not_in' => array(zn_get_the_id()), 'tax_query' => array(array('taxonomy' => 'portfolio_tags', 'field' => 'id', 'terms' => $tag_ids, 'operator' => 'IN'))); $portfolio_items = get_posts($args); } ?> <div class="znPortfolioRelated noTouch <?php echo $this->data['uid']; ?> " <?php echo $appear; ?> > <?php echo '<h3 class="zn_title sectionTitle h1 ' . $title_style . ' ">' . $title . '</h3>'; ?> <?php if (empty($portfolio_items) && $zn_framework->pagebuilder->is_pb_edit) { echo '<div class="zn-pb-notification">It seems that there are no related items</div>'; return; } elseif (empty($portfolio_items)) { _e('No related items found', 'zn_framework'); echo '</div>'; // CLOSING DIV return; } ?> <div class="row"> <div class="smallScreenSliderContainer"> <span class="Prev animate"><img alt="Previous" width="50" height="90" src="<?php echo THEME_BASE_URI; ?> /images/prevDark.png" /></span> <span class="Next animate"><img alt="Next" width="50" height="90" src="<?php echo THEME_BASE_URI; ?> /images/nextDark.png" /></span> </div> <div class="cloneOnSmallScreens"> <?php foreach ($portfolio_items as $post) { setup_postdata($post); ?> <!--PORTFOLIO ITEM--> <div class="<?php echo $columns_class; ?> "> <?php // FEATURED IMAGE if (has_post_thumbnail()) { $image = zn_get_post_image($post->ID, 370, 470, array('class' => 'img-responsive animate')); echo '<a class="scaleRotateImg portfolio_image" href="' . get_permalink() . '" title="' . get_the_title() . '">' . $image . '</a>'; } ?> </div> <!--END PORTFOLIO ITEM--> <?php } wp_reset_query(); ?> </div> </div> </div> <?php }
function element() { $title = $this->opt('title') ? '<h2 class="zn_title">' . $this->opt('title') . '</h2>' : ''; $submit_label = $this->opt('submit_label') ? $this->opt('submit_label') : 'Send message'; $fields = $this->opt('fields') ? $this->opt('fields') : ''; $captcha = $this->opt('captcha') ? $this->opt('captcha') : ''; $sent_message = $this->opt('sent_message') ? $this->opt('sent_message') : ''; //** Appear animation $appear_delay = $this->opt('appear_delay') ? $this->opt('appear_delay') : '0'; $appear = $this->opt('appear_animation') ? $this->opt('appear_animation') : ''; if (!empty($appear)) { $appear = 'data-appear="fade-in" data-appear-direction="' . $appear . '" data-appear-delay="' . $appear_delay . '"'; } $response = ''; self::$form_id++; //$this->form_id = self::$form_id++; if (empty($fields)) { echo '<div class="zn-pb-notification">Please configure the element options and add your contact fields.</div>'; return; } ?> <div class="zn_contact_form_container contactForm <?php echo $this->data['uid']; ?> " <?php echo $appear; ?> > <?php echo $title; ?> <?php if ($fields) { $icon_opt = $this->opt('submit_icon') ? $this->opt('submit_icon') : array("family" => "eleganticons", "unicode" => "ue86f"); $icon = !empty($icon_opt['family']) ? '<span class="zn_icon_box_icon" ' . zn_generate_icon($icon_opt) . '></span>' : ''; echo '<form></form>'; //** Hack deoarece nu aparea form-ul urmator echo '<form action="' . get_permalink(zn_get_the_id()) . '" method="post" class="zn_contact_form row" >'; if ($captcha) { $fields[] = array('name' => 'zn_captcha', 'type' => 'captcha', 'validation' => 'captcha', 'width' => 'col-sm-12'); } $fields[] = array('name' => 'zn_pb_form_submit_' . self::$form_id, 'validation' => 'none', 'type' => 'hidden', 'width' => 'col-sm-12'); $this->form_fields = $fields; // PRINT OUT THE FORM FIELDS echo $this->create_form_elements(); echo '<div class="col-sm-12">'; if ($this->submit && $this->form_send()) { $response = $sent_message; } elseif (isset($_POST['zn_pb_form_submit_' . self::$form_id])) { $response = __('There was a problem submiting your message. Please try again.', 'zn_framework'); } echo '<div class="zn_contact_ajax_response titleColor" id="zn_form_id' . self::$form_id . '" >' . $response . '</div>'; echo ' <span class="zn_submit_container"><span ' . zn_generate_icon($icon_opt) . ' class="submit descriptionColor"></span><input class="zn_contact_submit titleColor" type="submit" value="' . $submit_label . '"> </span></div>'; echo '</form>'; } ?> </div> <?php }
function zn_editor_enabler() { check_ajax_referer('zn_framework', 'security'); define('ZN_PB_AJAX', true); ZN()->pagebuilder->init(); $post_id = zn_get_the_id(); $status = get_post_meta($post_id, 'zn_page_builder_status', true); if ($status == 'enabled') { ZN()->pagebuilder->editor->disable_editor(); wp_send_json(array('status' => 'disabled')); } else { ZN()->pagebuilder->editor->enable_editor(); wp_send_json(array('status' => 'enabled')); } }