function st_page_builder_box($options = array()) { global $post, $pagenow, $wp_registered_sidebars; $name = '_st_page_builder'; echo '<input type="hidden" name="st_page_builder_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />'; $values = get_page_builder_options($post->ID); if (empty($values) || !count($values)) { $no_value = true; } else { $no_value = false; } if (!is_array($values)) { $values = (array) $values; } do_action('st_builder_items', $name, $values, $post); ?> <?php do_action('st_builder_meta', $name, $values, $post); ?> </div><!-- end stpb_pd_w --> <?php }
/** * Images column for posr type */ function st_manage_post_type_columns($column_name, $id) { global $wpdb; $size = 'st_small_thumb'; switch ($column_name) { case 'images': $html = ''; $st_page_options = get_page_builder_options($id); // echo get_the_post_thumbnail($id,array(40,40)); switch (strtolower($st_page_options['thumbnail_type'])) { case 'video': $video = st_get_video($st_page_options['video_code'], $data); $html = '<span class="video-thumb" video="' . $data['type'] . '" size=' . $size . ' video-id="' . $data['video_id'] . '"></span>'; break; case 'slider': if (count($st_page_options['thumbnails']['images'])) { foreach ($st_page_options['thumbnails']['images'] as $img_id) { $thumb_image_url = wp_get_attachment_image_src($img_id, $size); $post_title = get_the_title($post_id); $html .= ' <img alt="' . esc_attr($post_title) . '" src="' . $thumb_image_url[0] . '" >'; } } break; default: if (has_post_thumbnail($post_id)) { $thumb_image_url = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), $size); $post_title = get_the_title($post_id); $html = ' <img alt="' . esc_attr($post_title) . '" src="' . $thumb_image_url[0] . '" >'; } else { } } echo $html; break; default: break; } // end switch }
/** * Template Name: One Page Template Test * Author: Trang Huynh */ do_action('st_theme_start'); get_header(); $GLOBALS['st_template_file_name'] = 'page'; // get page template // get child pages of Home page $current_front_page_ID = get_option('page_on_front'); $section_list = get_childs($current_front_page_ID); do_action('st_before_layout'); foreach ($section_list as $page) { $slug = $page->post_name; $title = $page->post_title; $st_page_options = $st_page_builder = get_page_builder_options($page->ID); $builder_content = get_page_builder_content($page->ID); $showTitle = true; // echo $st_page_options['page_options']['show_title']; if (empty($st_page_options['page_options']['show_title']) || $st_page_options['page_options']['show_title'] == '') { $showTitle = false; } $showContent = true; if (empty($st_page_options['page_options']['show_content']) || $st_page_options['page_options']['show_content'] == '') { $showContent = false; } // get_template_part('templates/layout/'.st_get_layout()); do_action('st_top_page_template'); ?> <!-- Start Section <?php echo "{$slug}";
<?php if (is_singular()) { global $post; $st_page_builder = get_page_builder_options($post->ID); } else { $st_page_builder = array(); } if (!isset($st_page_builder['left_sidebar'])) { $st_page_builder['left_sidebar'] = ''; } ?> <div class="main-outer-wrapper" > <div class="main-wrapper mw-left-sidebar container container-bg"> <div class="main-content"> <div class="cloumn twelve b0"> <div class="row"> <?php /** * @hooked: st_page_tile_template(); - file lib/template-functions.php */ do_action('st_before_layout'); ?> <div class="eight column content-wrapper b0"> <div class="content"> <?php /**
<?php $title = ''; if (is_product_category() || is_product_tag()) { $title = single_term_title('', false); } elseif (is_product()) { $title = get_the_title(); } else { $post_id = st_get_shop_page(); $st_page_options = $st_page_builder = get_page_builder_options($post_id); if (empty($st_page_options) || isset($st_page_options['show_title']) && $st_page_options['show_title'] == 1) { $title = get_the_title($post_id); } else { $title = ''; } } if ($title) { ?> <div class="row shop-title"> <div class="twelve columns b0"> <div class="page-title-wrapper"> <h1 class="page-title left"><?php echo $title; ?> </h1> <?php woocommerce_result_count(); ?> <div class="page-title-alt right"><?php woocommerce_catalog_ordering();
<?php require_once '../../../wp-load.php'; if (isset($_GET['id']) && is_numeric($_GET['id'])) { $dt = get_page_builder_options($_GET['id']); $data = $dt['thumbnails']; $images = $data['images']; $metas = $data['meta']; $sliders = array(); if (count($images)) { foreach ($images as $k => $thumb_id) { $meta = $metas[$k]; $thumb_image_url = wp_get_attachment_image_src($thumb_id, 'st_large'); $thumb_image_url = $thumb_image_url[0]; $full_image_url = wp_get_attachment_image_src($thumb_id, 'full'); $full_image_url = $full_image_url[0]; $thumbnail_image_url = wp_get_attachment_image_src($thumb_id, 'thumbnail'); $thumbnail_image_url = $thumbnail_image_url[0]; $images['src_large'][] = $thumb_image_url; $images['src_thumbnail'][] = $thumbnail_image_url; $images['title'][] = stripslashes($meta['title']); $images['caption'][] = $meta['caption'] != '' ? '<p>' . stripslashes($meta['caption']) . '</p>' : ''; $images['src_full'][] = $full_image_url; } } $sCode = ''; $sTemplate = <<<XML <img> <src>{fileurl}</src> <title>{title}</title> <caption>{album_title}</caption>
/** * Return laoyout file by number */ function st_get_layout($number = -1) { if ($number < 1) { if (is_singular()) { global $post; $st_page_builder = get_page_builder_options($post->ID); $layout = isset($st_page_builder['layout']) ? intval($st_page_builder['layout']) : 0; if (in_array($layout, array(1, 2, 3, 4))) { $number = $layout; } } elseif (is_tax()) { // for default layout in admin page $tax = get_queried_object(); $number = intval(st_get_setting("{$tax->taxonomy}_layout", 0)); } if ($number <= 0) { $number = intval(st_get_setting("layout", 2)); } } // end if number switch (intval($number)) { case 4: $l = 'layout-left-right-sidebar'; break; case 3: $l = 'layout-left-sidebar'; break; case 2: $l = 'layout-right-sidebar'; break; case 1: $l = 'layout-no-sidebar'; break; default: $l = 'layout-right-sidebar'; } return apply_filters('st_get_layout', $l, $number); }
<?php /** * Left sidebar layout */ if (is_singular()) { global $post; $st_page_builder = get_page_builder_options($post->ID); } else { //$st_page_builder = array(); $page_for_posts = get_option('page_for_posts'); $st_page_builder = get_page_builder_options($page_for_posts); // default is Posts page } if (!isset($st_page_builder['left_sidebar'])) { $st_page_builder['left_sidebar'] = ''; } ?> <div class="main-outer-wrapper <?php echo main_outer_wrapper_class(); ?> "> <div class="main-wrapper container"> <div class="row row-wrapper"> <div class="page-outer-wrapper"> <div class="page-wrapper twelve columns page-wrapper-left-sidebar b0"> <?php
function st_post_thumbnail_gallery($post_id = '', $size = 'st_medium') { if (empty($size) || $size == '') { $size = 'st_medium'; } $st_page_options = get_page_builder_options($post_id); $html = ''; $title = esc_attr(get_the_title($post_id)); $link = get_permalink($post_id); switch (strtolower($st_page_options['thumbnail_type'])) { case 'video': $html = st_get_video($st_page_options['video_code'], $data); break; case 'slider': if (count($st_page_options['thumbnails']['images'])) { $first_img = ''; $list_img = array(); $gallery_id = 'gl' . uniqid(); $i = 0; $img_0 = ''; foreach ($st_page_options['thumbnails']['images'] as $thumb_id) { if ($i == 0) { $thumb_image_url_0 = wp_get_attachment_image_src($thumb_id, $size); $img_0 = $thumb_image_url_0[0]; } // for light box $thumb_image_url = wp_get_attachment_image_src($thumb_id, 'full'); $list_img[] = $thumb_image_url[0]; $i++; } $html = ''; if ($list_img) { $html = '<img src="' . $img_0 . '" alt=""> <div class="thumb-control-wrapper"> <ul class="thumb-control clearfix"> <li><a title="' . __('View Detail', 'smooththemes') . '" href="' . $link . '" class="go-detail">' . __('Open Detail', 'smooththemes') . '</a></li> <li><a rel="prettyPhoto[' . $gallery_id . ']" title="' . $title . '" href="' . $list_img[0] . '" class="go-gallery">' . __('Open Gallery', 'smooththemes') . '</a></li> '; unset($list_img[0]); if (count($list_img)) { $html .= '<div style="display:none">'; foreach ($list_img as $src) { $html .= '<a rel="prettyPhoto[' . $gallery_id . ']" title="' . $title . '" href="' . $src . '"></a>'; } $html .= '</div>'; } $html .= '</ul> </div>'; } } break; default: if (has_post_thumbnail($post_id)) { $thumb_image_url = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), $size); $thumb_image_url = $thumb_image_url[0]; $full_image_url = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'full'); $full_image_url = $full_image_url[0]; $html = '<img src="' . $thumb_image_url . '" alt=""> <div class="thumb-control-wrapper"> <ul class="thumb-control clearfix"> <li><a title="View Detail" href="' . $link . '" class="go-detail">' . __('Open Detail', 'smooththemes') . '</a></li> <li><a rel="prettyPhoto" title="' . $title . '" href="' . $full_image_url . '" class="go-gallery">' . __('Open Gallery', 'smooththemes') . '</a></li> </ul> </div>'; } } return apply_filters('st_post_thumbnail_gallery', $html, $post_id, $size); }