function section_template() { global $post; global $pagelines_ID; // inserts a clearing element at the end of each line of boxes $perline = pagelines_option('box_col_number', $pagelines_ID) ? pagelines_option('box_col_number', $pagelines_ID) : 3; if (get_pagelines_meta('box_set', $pagelines_ID)) { $set = get_post_meta($pagelines_ID, 'box_set', true); } elseif (pagelines_non_meta_data_page() && pagelines_option('box_default_tax')) { $set = pagelines_option('box_default_tax'); } else { $set = null; } if (pagelines_option('box_items', $pagelines_ID)) { $limit = pagelines_option('box_items', $pagelines_ID); } else { $limit = null; } $b = $this->load_pagelines_boxes($set, $limit); $this->draw_boxes($b, $perline, $set); }
function section_template() { global $pagelines_ID; $h_head = get_pagelines_meta('_highlight_head', $pagelines_ID); $h_subhead = get_pagelines_meta('_highlight_subhead', $pagelines_ID); $h_splash = get_pagelines_meta('_highlight_splash', $pagelines_ID); $h_splash_position = get_pagelines_meta('_highlight_splash_position', $pagelines_ID); ?> <?php if($h_head || $h_subhead || $h_splash):?> <div class="highlight-area"> <?php if($h_splash_position == 'top' && $h_splash):?> <div class="highlight-splash hl-image-top"> <img src="<?php echo $h_splash; ?>" alt="" /> </div> <?php endif; ?> <?php if($h_head):?> <h1 class="highlight-head"> <?php echo $h_head; ?> </h1> <?php endif;?> <?php if($h_subhead):?> <h3 class="highlight-subhead subhead"> <?php echo $h_subhead; ?> </h3> <?php endif;?> <?php if( $h_splash_position != 'top' && $h_splash):?> <div class="highlight-splash hl-image-bottom"> <img src="<?php echo $h_splash; ?>" alt="" /> </div> <?php endif; ?> </div> <?php endif;?> <?php }
function _get_menu_select($oid, $o) { global $post_ID; ?> <?php if (isset($o['label'])) { ?> <label class="metatext-label"><?php echo $o['label']; ?> </label><?php } ?> <select id="<?php echo $oid; ?> " name="<?php echo $oid; ?> "> <option value="" >—SELECT—</option> <?php $menus = wp_get_nav_menus(array('orderby' => 'name')); foreach ($menus as $menu) { printf('<option value="%d" %s>%s</option>', $menu->term_id, selected($menu->term_id, get_pagelines_meta($oid, $post_ID)), esc_html($menu->name)); } ?> </select> <?php }
function m_pagelines($option, $post) { return get_pagelines_meta($option, $post); }
function get_banner_posts() { global $post; if (!isset($this->the_banners) && isset($post)) { $query_args = array('post_type' => $this->id, 'orderby' => 'ID'); if (get_pagelines_meta('banner_set', $post->ID)) { $query_args = array_merge($query_args, array('banner-sets' => get_post_meta($post->ID, 'banner_set', true))); } $banner_query = new WP_Query($query_args); $this->the_banners = $banner_query->posts; if (is_array($this->the_banners)) { return $this->the_banners; } else { return array(); } } elseif (isset($post)) { return $this->the_banners; } }
function get_feature_posts() { global $post; global $pagelines_ID; if (!isset($this->the_feature_posts)) { if (pagelines_option('feature_source') == 'posts') { $query_args = array('post_type' => 'post', 'orderby' => 'ID'); if (pagelines_option('feature_category')) { $query_args = array_merge($query_args, array('cat' => pagelines('feature_category'))); } } else { $query_args = array('post_type' => $this->id, 'orderby' => 'ID'); if (get_pagelines_meta('feature_set', $pagelines_ID)) { $query_args = array_merge($query_args, array('feature-sets' => get_post_meta($pagelines_ID, 'feature_set', true))); } elseif (pagelines_non_meta_data_page() && pagelines_option('feature_default_tax')) { $query_args = array_merge($query_args, array('feature-sets' => pagelines_option('feature_default_tax'))); } } if (pagelines('feature_items', $pagelines_ID)) { $query_args = array_merge($query_args, array('showposts' => pagelines_option('feature_items', $pagelines_ID))); } $feature_query = new WP_Query($query_args); $this->the_feature_posts = $feature_query->posts; return $this->the_feature_posts; } else { return $this->the_feature_posts; } }
function _get_banner_media( $bpost ){ global $pagelines_ID; if(get_pagelines_meta('the_banner_image', $bpost->ID)){ $banner_media = '<img src="'.get_pagelines_meta('the_banner_image', $bpost->ID).'" alt="'.get_the_title().'" />'; } elseif(get_pagelines_meta('the_banner_media', $bpost->ID)){ $banner_media = get_pagelines_meta('the_banner_media', $bpost->ID); } else { $banner_media = ''; } // Filter output return apply_filters('pl_banner_image', $banner_media, $bpost->ID); }
/** * * @TODO document * */ function sc_inputs($template_slug, $sections, $o) { global $post; $is_special = isset($o['special']) ? true : false; // No sections in area if (empty($sections)) { echo sprintf('<div class="sc_inputs"><div class="emptyarea">%s</div></div>', __('Area is empty.', 'pagelines')); return; } echo '<div class="sc_inputs">'; foreach ($sections as $key => $sid) { $pieces = explode('ID', $sid); $section = (string) $pieces[0]; $clone_id = isset($pieces[1]) ? $pieces[1] : 1; // Get section information if (isset($this->factory[$section])) { $section_data = $this->factory[$section]; $hidden_by_default = isset($this->sc_global[$template_slug][$sid]['hide']) ? $this->sc_global[$template_slug][$sid]['hide'] : null; $check_type = $hidden_by_default ? 'show' : 'hide'; // Make the field 'key' $option_name = $is_special ? $this->sc_name($template_slug, $sid, $o['special'], $check_type) : meta_option_name(array($check_type, $template_slug, $sid)); $check_value = $is_special ? $this->sc_value($template_slug, $sid, $o['special'], $check_type) : get_pagelines_meta($option_name, $post->ID); // The name of the section $clone = $clone_id != 1 ? ' #' . $clone_id : ''; $check_label = ucfirst($check_type) . ' ' . $section_data->name . $clone; ?> <div class="sc_wrap <?php echo 'type_' . $check_type; ?> " > <label class="sc_button" for="<?php echo $option_name; ?> "> <span class="sc_button_pad fix" > <?php printf('<span class="sc_check_wrap"><input class="sc_check" type="checkbox" id="%1$s" name="%1$s" %2$s /></span>', $option_name, checked((bool) $check_value, true, false)); printf('<span class="sc_label"><span class="sc_label_pad" style="background: url(%s) no-repeat 8px 5px;">%s</span></span>', $section_data->icon, $check_label); ?> </span> </label> </div><?php } } echo '</div>'; }
function get_section_posts() { global $post; if ((!isset($this->the_section_posts) || !is_array($this->the_section_posts)) && isset($post)) { $query_args = array('post_type' => $this->settings['posttype'], 'orderby' => 'ID'); if (get_pagelines_meta('_soapbox_set', $post->ID)) { $query_args = array_merge($query_args, array('box-sets' => get_post_meta($post->ID, '_soapbox_set', true))); } elseif (pagelines_non_meta_data_page() && pagelines_option('soapbox_default_tax')) { $query_args = array_merge($query_args, array('box-sets' => pagelines_option('soapbox_default_tax'))); } $num_items = pagelines_option('_soapbox_items', $post->ID) ? pagelines_option('_soapbox_items', $post->ID) : 10; $query_args = array_merge($query_args, array('showposts' => $num_items)); $section_query = new WP_Query($query_args); $this->the_section_posts = $section_query->posts; if (is_array($this->the_section_posts)) { return $this->the_section_posts; } else { return array(); } } elseif (isset($post)) { return $this->the_section_posts; } }
function get_box_posts() { global $post; if (!isset($this->the_feature_boxes) && isset($post)) { $query_args = array('post_type' => $this->id, 'orderby' => 'ID'); if (get_pagelines_meta('box_set', $post->ID)) { $query_args = array_merge($query_args, array('box-sets' => get_post_meta($post->ID, 'box_set', true))); } elseif (pagelines_non_meta_data_page() && pagelines_option('box_default_tax')) { $query_args = array_merge($query_args, array('box-sets' => pagelines_option('box_default_tax'))); } if (pagelines('box_items', $post->ID)) { $query_args = array_merge($query_args, array('showposts' => pagelines_option('box_items', $post->ID))); } $boxes_query = new WP_Query($query_args); $this->the_feature_boxes = $boxes_query->posts; if (is_array($this->the_feature_boxes)) { return $this->the_feature_boxes; } else { return array(); } } elseif (isset($post)) { return $this->the_feature_boxes; } }
function section_control_checkbox($section, $template_slug, $template_area, $template) { global $pl_section_factory; global $post; if (!isset($pl_section_factory->sections[$section])) { return; } $s = $pl_section_factory->sections[$section]; // Load Global Section Control Options $section_control = pagelines_option('section-control'); $hidden_by_default = isset($section_control[$template_slug][$section]['hide']) ? $section_control[$template_slug][$section]['hide'] : null; $check_type = $hidden_by_default ? 'show' : 'hide'; // used to be _hide_SectionClass; // needs to be _hide_TemplateSlug_SectionClass // Why? $check_name = "_" . $check_type . "_" . $section; $check_label = ucfirst($check_type) . " " . $s->name; $check_value = get_pagelines_meta($check_name, $post->ID); ?> <div class="section_checkbox_row <?php echo 'type_' . $check_type; ?> " > <input class="section_control_check" type="checkbox" id="<?php echo $check_name; ?> " name="<?php echo $check_name; ?> " <?php checked((bool) $check_value); ?> /> <label for="<?php echo $check_name; ?> "><?php echo $check_label; ?> </label> </div> <?php }
function draw_meta_options() { global $post_ID; ?> <div class="pagelines_pagepost_options"> <?php foreach ($this->meta_array as $optionid => $o) { ?> <?php if (isset($o['where']) && $o['where'] != $this->settings['posttype']) { } else { ?> <?php if (VPRO || !VPRO && $o['version'] != 'pro') { ?> <div class="page_option"> <div class="option-description"> <label for="<?php echo $optionid; ?> "><strong><?php echo $o['inputlabel']; ?> </strong></label><br/> <small><?php echo $o['exp']; ?> </small> </div> <?php if ($o['type'] == 'check') { ?> <div class="option-inputs"> <input class="admin_checkbox" type="checkbox" id="<?php echo $optionid; ?> " name="<?php echo $optionid; ?> " <?php checked((bool) m_pagelines($optionid, $post_ID)); ?> /> </div> <?php } elseif ($o['type'] == 'textarea') { ?> <div class="option-inputs"> <textarea class="html-textarea" id="<?php echo $optionid; ?> " name="<?php echo $optionid; ?> " /><?php em_pagelines($optionid, $post_ID); ?> </textarea> </div> <?php } elseif ($o['type'] == 'text' || $o['type'] == 'text_small' || $o['type'] == 'text_link' || $o['type'] == 'text_big') { ?> <div class="option-inputs"> <input type="text" class="html-text <?php echo 'meta-' . $o['type']; ?> " id="<?php echo $optionid; ?> " name="<?php echo $optionid; ?> " value="<?php em_pagelines($optionid, $post_ID); ?> " /> </div> <?php } elseif ($o['type'] == 'select') { ?> <div class="option-inputs"> <select id="<?php echo $optionid; ?> " name="<?php echo $optionid; ?> "> <option value="">—<?php _e("SELECT", 'pagelines'); ?> —</option> <?php foreach ($o['selectvalues'] as $sval => $sset) { ?> <?php if ($o['type'] == 'select_same') { ?> <option value="<?php echo $sset; ?> " <?php if (get_pagelines_meta($optionid, $post_ID) == $sset) { echo 'selected'; } ?> ><?php echo $sset; ?> </option> <?php } elseif (is_array($sset)) { $disabled_option = isset($sset['version']) && $sset['version'] == 'pro' && !VPRO ? true : false; ?> <option <?php if ($disabled_option) { echo 'disabled="disabled" class="disabled_option"'; } ?> value="<?php echo $sval; ?> " <?php if (get_pagelines_meta($optionid, $post_ID) == $sval) { echo 'selected'; } ?> ><?php echo $sset['name']; if ($disabled_option) { echo ' (pro)'; } ?> </option> <?php } else { ?> <option value="<?php echo $sval; ?> " <?php if (get_pagelines_meta($optionid, $post_ID) == $sval) { echo 'selected'; } ?> ><?php echo $sset; ?> </option> <?php } ?> <?php } ?> </select> </div> <?php } elseif ($o['type'] == 'count_select') { ?> <div class="option-inputs"> <select id="<?php echo $optionid; ?> " name="<?php echo $optionid; ?> "> <option value="">—SELECT—</option> <?php if (isset($o['count_start'])) { $count_start = $o['count_start']; } else { $count_start = 0; } ?> <?php for ($i = $count_start; $i <= $o['count_number']; $i++) { ?> <option value="<?php echo $i; ?> " <?php selected($i, get_pagelines_meta($optionid, $post_ID)); ?> ><?php echo $i; ?> </option> <?php } ?> </select> </div> <?php } elseif ($o['type'] == 'image_upload') { ?> <div class="option-inputs"> <p> <label class="context" for="<?php echo $optionid; ?> "><?php echo $o['inputlabel']; ?> </label><br/> <input class="regular-text uploaded_url" type="text" name="<?php echo $optionid; ?> " value="<?php em_pagelines($optionid, $post_ID); ?> " /><br/><br/> <span id="<?php echo $optionid; ?> " class="image_upload_button button">Upload Image</span> <span title="<?php echo $optionid; ?> " id="<?php echo $optionid; ?> " class="image_reset_button button">Remove</span> <input type="hidden" class="ajax_action_url" name="wp_ajax_action_url" value="<?php echo admin_url("admin-ajax.php"); ?> " /> <input type="hidden" class="image_preview_size" name="img_size_<?php echo $optionid; ?> " value="100"/> </p> <?php if (m_pagelines($optionid, $post_ID)) { ?> <img class="pagelines_image_preview" id="image_<?php echo $optionid; ?> " src="<?php em_pagelines($optionid, $post_ID); ?> " style="max-width: 100px"/> <?php } ?> </div> <?php } elseif ($o['type'] == 'select_taxonomy') { ?> <?php $terms_array = get_terms($o['taxonomy_id']); ?> <div class="option-inputs"> <?php if (is_array($terms_array) && !empty($terms_array)) { ?> <select id="<?php echo $optionid; ?> " name="<?php echo $optionid; ?> "> <option value="">—<?php _e("SELECT", 'pagelines'); ?> —</option> <?php foreach ($terms_array as $term) { ?> <option value="<?php echo $term->slug; ?> " <?php if (get_pagelines_meta($optionid, $post_ID) == $term->slug) { echo 'selected'; } ?> ><?php echo $term->name; ?> </option> <?php } ?> </select> <?php } else { ?> <div class="meta-message">No sets have been created and added to a post yet!</div> <?php } ?> </div> <?php } ?> <div class="clear"></div> </div> <?php } ?> <?php } ?> <?php } ?> <div class="page_option fix update-meta-options"> <input type="hidden" name="_posttype" value="<?php echo $this->settings['posttype']; ?> " /> <input id="update" class="button-primary" type="submit" value="<?php _e("Update Options", 'pagelines'); ?> " accesskey="p" tabindex="5" name="update"/> </div> </div> <?php }
function pagelines_features_set(){ global $post; global $pagelines_ID; if( get_pagelines_meta('feature_set', $pagelines_ID) ) $this->set = get_post_meta($pagelines_ID, 'feature_set', true); elseif (pagelines_option('feature_default_tax')) $this->set = pagelines_option('feature_default_tax'); else $this->set = null; $limit = (pagelines_option('feature_items', $pagelines_ID)) ? pagelines_option('feature_items', $pagelines_ID) : null; $source = (pagelines_option('feature_source') == 'posts') ? 'posts' : 'customtype'; $f = $this->load_pagelines_features($this->set, $limit, $source); return $f; }