/** * Meta Box initialization */ function init_boxes() { //load the options array if (!empty($this->default_boxes) && !empty($this->box_elements)) { //loop over the box array foreach ($this->default_boxes as $key => $box) { foreach ($box['page'] as $area) { //class filter for expanded items if (!empty($box['expandable'])) { if (!empty($_GET['avia-expanded']) && $_GET['avia-expanded'] === $box['id']) { add_filter("postbox_classes_{$area}_{$box['id']}", array($this, 'add_meta_box_class')); //postbox class filter } } global $post_ID; //class filter for hiden items if ('avia_builder' === $box['id'] && isset($_GET['post']) && AviaHelper::builder_status($_GET['post']) != 'active' || 'avia_builder' === $box['id'] && empty($_GET['post'])) { add_filter("postbox_classes_{$area}_{$box['id']}", array($this, 'add_meta_box_hidden')); //postbox class filter } //meta box creation $box['iteration'] = $key; add_meta_box($box['id'], $box['title'], array(&$this, 'create_meta_box'), $area, $box['context'], $box['priority'], array('avia_current_box' => $box)); } } } }
/** * function called by the metabox class that creates the interface in your wordpress backend **/ public function visual_editor($element) { $output = ""; $title = ""; $i = 0; $this->shortcode_buttons = apply_filters('avia_show_shortcode_button', array()); if (!empty($this->shortcode_buttons) && $this->disable_drag_drop == false) { $this->tabs = isset($element['tab_order']) ? array_flip($element['tab_order']) : array(); foreach ($this->tabs as &$empty_tabs) { $empty_tabs = array(); } foreach ($this->shortcode_buttons as $shortcode) { if (empty($shortcode['tinyMCE']['tiny_only'])) { if (!isset($shortcode['tab'])) { $shortcode['tab'] = __("Custom Elements", 'avia_framework'); } $this->tabs[$shortcode['tab']][] = $shortcode; } } foreach ($this->tabs as $key => $tab) { if (empty($tab)) { continue; } usort($tab, array($this, 'sortByOrder')); $i++; $title .= "<a href='#avia-tab-{$i}'>" . $key . "</a>"; $output .= "<div class='avia-tab avia-tab-{$i}'>"; foreach ($tab as $shortcode) { if (empty($shortcode['invisible'])) { $output .= $this->create_shortcode_button($shortcode); } } $output .= "</div>"; } } global $post_ID; $active_builder = AviaHelper::builder_status($post_ID); $extra = AviaBuilder::$mode != true ? "" : "avia_mode_" . AviaBuilder::$mode; $hotekey_info = htmlentities($element['desc'], ENT_QUOTES, get_bloginfo('charset')); $output = '<div class="shortcode_button_wrap avia-tab-container"><div class="avia-tab-title-container">' . $title . '</div>' . $output . '</div>'; $output .= '<input type="hidden" value="' . $active_builder . '" name="aviaLayoutBuilder_active" id="aviaLayoutBuilder_active" />'; if ($this->disable_drag_drop == false) { $output .= '<a href="#info" class="avia-hotkey-info" data-avia-help-tooltip="' . $hotekey_info . '">' . __('Information', 'avia_framework') . '</a>'; $output .= $this->builderTemplate->create_save_button(); } $output .= "<div class='layout-builder-wrap {$extra}'>"; if ($this->disable_drag_drop == false) { $output .= "\t<div class='avia-controll-bar'></div>"; } $output .= "\t<div id='aviaLayoutBuilder' class='avia-style avia_layout_builder avia_connect_sort preloading av_drop' data-dragdrop-level='0'>"; $output .= "\t</div>"; $clean_data = get_post_meta($post_ID, '_aviaLayoutBuilderCleanData', true); // $clean_data = htmlentities($clean_data, ENT_QUOTES, get_bloginfo( 'charset' )); //entity-test: added htmlentities $output .= "\t<textarea id='_aviaLayoutBuilderCleanData' name='_aviaLayoutBuilderCleanData'>" . $clean_data . "</textarea>"; $output .= "</div>"; return $output; }
function avia_woocommerce_default_page($query) { if (current_theme_supports('avia_custom_shop_page')) { if (!$query->is_admin && $query->is_main_query() && !$query->is_tax && $query->is_archive && $query->is_post_type_archive) { $vars = $query->query_vars; if (isset($vars['post_type']) && 'product' == $vars['post_type']) { $shop_page_id = wc_get_page_id('shop'); $builder_active = AviaHelper::builder_status($shop_page_id); if ($builder_active == "active") { $query->set('post_type', 'page'); $query->set('p', $shop_page_id); $query->set('meta_query', array()); $query->is_singular = true; $query->is_page = true; $query->is_archive = false; $query->is_post_type_archive = false; $query->query = array('p' => $shop_page_id, 'post_type' => 'page'); } } } } return $query; }
* get the current post id, the current post class and current post format */ $url = ""; $current_post = array(); $current_post['post_loop_count'] = $post_loop_count; $current_post['the_id'] = get_the_ID(); $current_post['parity'] = $post_loop_count % 2 ? 'odd' : 'even'; $current_post['last'] = count($wp_query->posts) == $post_loop_count ? " post-entry-last " : ""; $current_post['post_type'] = get_post_type($current_post['the_id']); $current_post['post_class'] = "post-entry-" . $current_post['the_id'] . " post-loop-" . $post_loop_count . " post-parity-" . $current_post['parity'] . $current_post['last'] . " " . $blog_style; $current_post['post_class'] .= $current_post['post_type'] == "post" ? '' : ' post'; $current_post['post_format'] = get_post_format() ? get_post_format() : 'standard'; $current_post['post_layout'] = avia_layout_class('main', false); $blog_content = !empty($avia_config['blog_content']) ? $avia_config['blog_content'] : "content"; /*If post uses builder change content to exerpt on overview pages*/ if (AviaHelper::builder_status($current_post['the_id']) && !is_singular($current_post['the_id']) && $current_post['post_type'] == 'post') { $current_post['post_format'] = 'standard'; $blog_content = "excerpt_read_more"; } /* * retrieve slider, title and content for this post,... */ $size = strpos($blog_style, 'big') ? strpos($current_post['post_layout'], 'sidebar') !== false ? 'entry_with_sidebar' : 'entry_without_sidebar' : 'square'; if (!empty($avia_config['preview_mode']) && !empty($avia_config['image_size']) && $avia_config['preview_mode'] == 'custom') { $size = $avia_config['image_size']; } $current_post['slider'] = get_the_post_thumbnail($current_post['the_id'], $size); if (is_single($initial_id) && get_post_meta($current_post['the_id'], '_avia_hide_featured_image', true)) { $current_post['slider'] = ""; } $current_post['title'] = get_the_title();