function getPost() { $data = new stdClass(); $categoryId = (int) get_query_var('cat'); if (is_tag()) { $data->post = get_post(ThemeOption::getOption('blog_search_post_id')); $tagQuery = get_query_var('tag'); $tagData = get_tags(array('slug' => $tagQuery)); $data->post->post_title = esc_html($tagData[0]->name); } elseif (is_category($categoryId)) { $category = get_category($categoryId); $data->post = get_post(ThemeOption::getOption('blog_category_post_id')); $data->post->post_title = ThemeHelper::esc_html($category->name); } elseif (is_day()) { $data->post = get_post(ThemeOption::getOption('blog_archive_post_id')); $data->post->post_title = get_the_date(); } elseif (is_archive()) { $data->post = get_post(ThemeOption::getOption('blog_archive_post_id')); $data->post->post_title = single_month_title(' ', false); } elseif (is_search()) { $data->post = get_post(ThemeOption::getOption('blog_search_post_id')); $data->post->post_title = sprintf(__('Search result for phrase <i>%s</i>', THEME_DOMAIN), esc_html(get_query_var('s'))); } elseif (is_404()) { $data->post = get_post(ThemeOption::getOption('page_404_page_id')); $data->post->post_title = $data->post->post_title; } else { return false; } return $data; }
function import() { $response = array('global' => array('error' => 1)); $Notice = new ThemeNotice(); $result = $this->download(); if ($result) { $response['global']['error'] = 0; } else { $Notice->addError(ThemeHelper::getFormName('import_google_font', false), ThemeHelper::esc_html('Cannot import list of fonts')); $response['local'] = $Notice->getError(); } $response['global']['notice'] = $Notice->createHTML(THEME_PATH_TEMPLATE . 'notice.php'); echo json_encode($response); exit; }
function getPost() { $data = new stdClass(); global $post, $wp_query; $categoryId = (int) get_query_var('cat'); if (function_exists('is_woocommerce') && is_woocommerce()) { $data->post = get_post(get_option('woocommerce_shop_page_id')); if (is_product()) { $data->post = $post; } elseif (is_product_category() || is_product_tag()) { $data->post->post_title = ThemeHelper::esc_html($wp_query->queried_object->name); } elseif (is_search()) { $data->post->post_title = sprintf(__('Search products for phrase <i>%s</i>', THEME_DOMAIN), esc_html(get_query_var('s'))); } setup_postdata($data->post); } else { if (is_tag()) { $data->post = get_post(ThemeOption::getOption('blog_search_post_id')); $tagQuery = get_query_var('tag'); $tagData = get_tags(array('slug' => $tagQuery)); $data->post->post_title = esc_html($tagData[0]->name); } elseif (is_author()) { $author = get_userdata(get_query_var('author')); $data->post = get_post(ThemeOption::getOption('blog_author_post_id')); $data->post->post_title = sprintf(__('All posts from %s', THEME_DOMAIN), get_the_author_meta('display_name', $author->data->ID)); } elseif (is_category($categoryId)) { $category = get_category($categoryId); $data->post = get_post(ThemeOption::getOption('blog_category_post_id')); $data->post->post_title = ThemeHelper::esc_html($category->name); } elseif (is_day()) { $data->post = get_post(ThemeOption::getOption('blog_archive_post_id')); $data->post->post_title = get_the_date(); } elseif (is_archive()) { $data->post = get_post(ThemeOption::getOption('blog_archive_post_id')); $data->post->post_title = single_month_title(' ', false); } elseif (is_search()) { $data->post = get_post(ThemeOption::getOption('blog_search_post_id')); $data->post->post_title = sprintf(__('Kết quả tìm kiếm: <i>%s</i>', THEME_DOMAIN), esc_html(get_query_var('s'))); } elseif (is_404()) { $data->post = get_post(ThemeOption::getOption('page_404_page_id')); $data->post->post_title = $data->post->post_title; } else { return false; } } return $data; }
<ul class="to-form-field-list"> <li> <h5><?php esc_html_e('Custom javascript code', THEME_DOMAIN); ?> </h5> <span class="to-legend"><?php esc_html_e('Don\'t enter <script> tags. These tags will be added automatically.', THEME_DOMAIN); ?> </span> <div> <textarea id="<?php ThemeHelper::getFormName('custom_js_code'); ?> " name="<?php ThemeHelper::getFormName('custom_js_code'); ?> " rows="1" cols="1"><?php echo ThemeHelper::esc_html($this->data['option']['custom_js_code']); ?> </textarea> </div> </li> </ul>
foreach ($this->data['dictionary']['responsiveMedia'] as $index => $value) { if ($index == 1) { continue; } ?> <li> <h5><?php echo sprintf(esc_html__('CSS styles for page width between %s px and %s px.', THEME_DOMAIN), $value['min-width'], $value['max-width']); ?> </h5> <span class="to-legend"><?php echo sprintf(esc_html__('CSS styles for page width between %s px and %s px.', THEME_DOMAIN), $value['min-width'], $value['max-width']); ?> </span> <div> <textarea id="<?php ThemeHelper::getFormName('custom_css_responsive_' . $index); ?> " name="<?php ThemeHelper::getFormName('custom_css_responsive_' . $index); ?> " rows="1" cols="1" class="css-editor"><?php echo ThemeHelper::esc_html($this->data['option']['custom_css_responsive_' . $index]); ?> </textarea> </div> </li> <?php } ?> </ul>
</h5> <span class="to-legend"><?php esc_html_e('Select one of the available posts types and enter additional details about it (if needed).', THEME_DOMAIN); ?> </span> <div class="to-clear-fix"> <select name="<?php ThemeHelper::getFormName('post_type'); ?> " id="<?php ThemeHelper::getFormName('post_type'); ?> "> <?php foreach ($this->data['dictionary']['postType'] as $index => $value) { echo '<option value="' . ThemeHelper::esc_attr($index) . '" ' . ThemeHelper::selectedIf($this->data['option']['post_type'], $index, false) . '>' . ThemeHelper::esc_html($value[0]) . '</option>'; } ?> </select> </div> </li> <li> <h5><?php esc_html_e('Preambule', THEME_DOMAIN); ?> </h5> <span class="to-legend"><?php esc_html_e('Enter preambule (the top part of the post, e.g: video, audio, image slider etc.) of the post. You can use shortcodes in this field.', THEME_DOMAIN); ?> </span> <div class="to-clear-fix">
<ul class="to-form-field-list"> <li> <h5><?php esc_html_e('404 error page', THEME_DOMAIN); ?> </h5> <span class="to-legend"><?php esc_html_e('Get settings for 404 page from selected page.', THEME_DOMAIN); ?> </span> <div class="to-clear-fix"> <select name="<?php ThemeHelper::getFormName('page_404_page_id'); ?> " id="<?php ThemeHelper::getFormName('page_404_page_id'); ?> "> <?php foreach ($this->data['dictionary']['page'] as $value) { echo '<option value="' . ThemeHelper::esc_attr($value->ID) . '" ' . ThemeHelper::selectedIf($this->data['option']['page_404_page_id'], $value->ID, false) . '>' . ThemeHelper::esc_html($value->post_title) . '</option>'; } ?> </select> </div> </li> </ul>
esc_html_e('Footer layout', THEME_DOMAIN); ?> </h5> <span class="to-legend"><?php esc_html_e('Select layout of widgets in footer. This option works only if this widget area is selected as sidebar in footer.', THEME_DOMAIN); ?> </span> <div class="to-clear-fix"> <select name="<?php ThemeHelper::getFormName('widget_area_footer_layout'); ?> " id="<?php ThemeHelper::getFormName('widget_area_footer_layout'); ?> "> <?php foreach ($this->data['dictionary']['layout'] as $index => $value) { echo '<option value="' . ThemeHelper::esc_attr($index) . '" ' . ThemeHelper::selectedIf($this->data['option']['widget_area_footer_layout'], $index, false) . '>' . ThemeHelper::esc_html($index) . '</option>'; } ?> </select> </div> </li> </ul> </div> <script type="text/javascript"> jQuery(document).ready(function($) { $('.to').themeOptionElement({init:true}); }); </script>
</div> <div class="to-clear-fix"> <span class="to-legend-field"><?php esc_html_e('Previous:', THEME_DOMAIN); ?> </span> <select name="<?php ThemeHelper::getFormName('fancybox_image_easing_previous'); ?> " id="<?php ThemeHelper::getFormName('fancybox_image_easing_previous'); ?> "> <?php foreach ($this->data['dictionary']['easingType'] as $index => $value) { echo '<option value="' . ThemeHelper::esc_attr($index) . '" ' . ThemeHelper::selectedIf($this->data['option']['fancybox_image_easing_previous'], $index, false) . '>' . ThemeHelper::esc_html($value[0]) . '</option>'; } ?> </select> </div> </li> <li> <h5><?php esc_html_e('Speed', THEME_DOMAIN); ?> </h5> <span class="to-legend"><?php esc_html_e('The time it takes (in ms) to complete transition.', THEME_DOMAIN); ?> </span> <div>
<?php esc_html_e('Specify the image size. For options "Length" and "Percentage" you have to specify these values in next field.', THEME_DOMAIN); ?> <br/> </span> <div class="to-clear-fix"> <select name="<?php ThemeHelper::getFormName('header_background_image_size_1'); ?> " id="<?php ThemeHelper::getFormName('header_background_image_size_1'); ?> "> <?php foreach ($this->data['dictionary']['backgroundSize'] as $index => $value) { echo '<option value="' . ThemeHelper::esc_attr($index) . '" ' . ThemeHelper::selectedIf($this->data['option']['header_background_image_size_1'], $index, false) . '>' . ThemeHelper::esc_html($value[0]) . '</option>'; } ?> </select> </div> </li> <li> <h5><?php esc_html_e('Background image size', THEME_DOMAIN); ?> </h5> <span class="to-legend"> <?php esc_html_e('Sets the width and height of the background image.', THEME_DOMAIN); ?> <br/>
$i = 0; foreach ($this->data['dictionary']['postCategory'] as $index => $value) { $i++; ?> <input type="checkbox" name="<?php ThemeHelper::getFormName('post_category[]'); ?> " id="<?php ThemeHelper::getFormName('post_category_' . $i); ?> " value="<?php echo ThemeHelper::esc_attr($index); ?> " <?php ThemeHelper::checkedIf($this->data['option']['post_category'], $index); ?> /> <label for="<?php ThemeHelper::getFormName('post_category_' . $i); ?> "><?php echo ThemeHelper::esc_html($value); ?> </label> <?php } ?> </div> </li> </ul> </div>
</h5> <span class="to-legend"><?php esc_html_e('Select top menu.', THEME_DOMAIN); ?> </span> <div class="to-clear-fix"> <select name="<?php ThemeHelper::getFormName('menu_top_woocommerce'); ?> " id="<?php ThemeHelper::getFormName('menu_top_woocommerce'); ?> "> <?php foreach ($this->data['dictionary']['menu-1'] as $index => $value) { echo '<option value="' . ThemeHelper::esc_attr($index) . '" ' . ThemeHelper::selectedIf($this->data['option']['menu_top_woocommerce'], $index, false) . '>' . ThemeHelper::esc_html($value[0]) . '</option>'; } ?> </select> </div> </li> </ul> <script type="text/javascript"> jQuery(document).ready(function($) { var element=$('.to').themeOptionElement();; element.bindBrowseMedia('#<?php ThemeHelper::getFormName('header_background_image_src_woocommerce_browse'); ?> '); });
echo ThemeHelper::esc_attr($this->data['option']['go_to_page_top_animation_duration']); ?> " maxlength="5"/> </div> </li> <li> <h5><?php esc_html_e('Easing', THEME_DOMAIN); ?> </h5> <span class="to-legend"><?php esc_html_e('Easing method of animation.', THEME_DOMAIN); ?> </span> <div class="to-clear-fix"> <select name="<?php ThemeHelper::getFormName('go_to_page_top_animation_easing'); ?> " id="<?php ThemeHelper::getFormName('go_to_page_top_animation_easing'); ?> "> <?php foreach ($this->data['dictionary']['easingType'] as $index => $value) { echo '<option value="' . ThemeHelper::esc_attr($index) . '" ' . ThemeHelper::selectedIf($this->data['option']['go_to_page_top_animation_easing'], $index, false) . '>' . ThemeHelper::esc_html($value[0]) . '</option>'; } ?> </select> </div> </li> </ul>
echo ThemeHelper::esc_html($value->data->display_name); ?> </label> <?php } ?> </div> </li> <li> <h5><?php esc_html_e('Disable maintenance mode for IP addreses', THEME_DOMAIN); ?> </h5> <span class="to-legend"><?php esc_html_e('Allow to visit page (in normal mode) visitors from selected (seperated by line break) IP addresses:', THEME_DOMAIN); ?> </span> <div> <textarea id="<?php ThemeHelper::getFormName('maintenance_mode_ip_address'); ?> " name="<?php ThemeHelper::getFormName('maintenance_mode_ip_address'); ?> " rows="1" cols="1"><?php echo ThemeHelper::esc_html($this->data['option']['maintenance_mode_ip_address']); ?> </textarea> </div> </li> </ul>