/** * * * @package Kopa * @subpackage Core * @author thethangtran <*****@*****.**> * @since 1.0.0 * */ public function __construct($id_base, $name, $widget_options = array(), $control_options = array()) { parent::__construct($id_base, $name, $widget_options, $control_options); $g_style = array('size' => 4, 'fields' => array()); $g_style['fields']['title'] = array('type' => 'text', 'id' => 'title', 'name' => 'title', 'default' => '', 'classes' => array(), 'label' => __('Title', kopa_get_domain()), 'help' => NULL); $g_style['fields']['posts_per_page'] = array('type' => 'number', 'id' => 'posts_per_page', 'name' => 'posts_per_page', 'default' => 4, 'classes' => array(), 'label' => __('Number of posts', kopa_get_domain()), 'help' => NULL); $g_style['fields']['excerpt_character_limit'] = array('type' => 'number', 'id' => 'excerpt_character_limit', 'name' => 'excerpt_character_limit', 'default' => 100, 'classes' => array(), 'label' => __('Excerpt character limit', kopa_get_domain()), 'help' => NULL); $g_style['fields']['is_hide_title'] = array('type' => 'checkbox', 'id' => 'is_hide_title', 'name' => 'is_hide_title', 'default' => 'false', 'classes' => array(), 'label' => __('Is hide title', kopa_get_domain()), 'help' => NULL, 'is_append_label_before_control' => false); $g_style['fields']['is_hide_excerpt'] = array('type' => 'checkbox', 'id' => 'is_hide_excerpt', 'name' => 'is_hide_excerpt', 'default' => 'false', 'classes' => array(), 'label' => __('Is hide excerpt', kopa_get_domain()), 'help' => NULL, 'is_append_label_before_control' => false); $g_style['fields']['is_hide_created_date'] = array('type' => 'checkbox', 'id' => 'is_hide_created_date', 'name' => 'is_hide_created_date', 'default' => 'false', 'classes' => array(), 'label' => __('Is hide created date', kopa_get_domain()), 'help' => NULL, 'is_append_label_before_control' => false); $g_style['fields']['is_hide_comments'] = array('type' => 'checkbox', 'id' => 'is_hide_comments', 'name' => 'is_hide_comments', 'default' => 'false', 'classes' => array(), 'label' => __('Is hide comments', kopa_get_domain()), 'help' => NULL, 'is_append_label_before_control' => false); $g_style['fields']['is_hide_views'] = array('type' => 'checkbox', 'id' => 'is_hide_views', 'name' => 'is_hide_views', 'default' => 'false', 'classes' => array(), 'label' => __('Is hide views', kopa_get_domain()), 'help' => NULL, 'is_append_label_before_control' => false); $g_style['fields']['is_hide_likes'] = array('type' => 'checkbox', 'id' => 'is_hide_likes', 'name' => 'is_hide_likes', 'default' => 'false', 'classes' => array(), 'label' => __('Is hide likes', kopa_get_domain()), 'help' => NULL, 'is_append_label_before_control' => false); $g_style['fields']['is_hide_readmore'] = array('type' => 'checkbox', 'id' => 'is_hide_readmore', 'name' => 'is_hide_readmore', 'default' => 'false', 'classes' => array(), 'label' => __('Is hide readmore', kopa_get_domain()), 'help' => NULL, 'is_append_label_before_control' => false); $g_query = array('size' => 8, 'fields' => array()); $g_query['fields']['category'] = array('type' => 'taxonomy', 'id' => 'category', 'name' => 'category', 'default' => '', 'classes' => array(), 'label' => __('Categories', kopa_get_domain()), 'help' => NULL, 'taxonomy' => 'category', 'attributes' => array('multiple' => 'multiple')); $g_query['fields']['post_tag'] = array('type' => 'taxonomy', 'id' => 'post_tag', 'name' => 'post_tag', 'default' => '', 'classes' => array(), 'label' => __('Tags', kopa_get_domain()), 'help' => NULL, 'taxonomy' => 'post_tag', 'attributes' => array('multiple' => 'multiple')); $g_query['fields']['post_tag'] = array('type' => 'taxonomy', 'id' => 'post_tag', 'name' => 'post_tag', 'default' => '', 'classes' => array(), 'label' => __('Tags', kopa_get_domain()), 'help' => NULL, 'taxonomy' => 'post_tag', 'attributes' => array('multiple' => 'multiple')); $g_query['fields']['post_format'] = array('type' => 'taxonomy', 'id' => 'post_format', 'name' => 'post_format', 'default' => '', 'classes' => array(), 'label' => __('Post Format', kopa_get_domain()), 'help' => NULL, 'taxonomy' => 'post_format', 'attributes' => array('multiple' => 'multiple')); $g_query['fields']['orderby'] = array('type' => 'select', 'id' => 'orderby', 'name' => 'orderby', 'default' => 'date', 'classes' => array(), 'label' => __('Order by', kopa_get_domain()), 'help' => NULL, 'options' => array('date' => __('Latest news', kopa_get_domain()), 'popular' => __('Popular by view count', kopa_get_domain()), 'comment_count' => __('Most comments', kopa_get_domain()), 'rand' => __('Random', kopa_get_domain()))); $g_query['fields']['relation'] = array('type' => 'checkbox', 'id' => 'relation', 'name' => 'relation', 'default' => 'false', 'classes' => array(), 'label' => __('Is combine condition by <i>Tags</i>, <i>Categories</i>, <i>Format</i>', kopa_get_domain()), 'help' => NULL, 'is_append_label_before_control' => false); $g_query['fields']['timestamp'] = array('type' => 'select', 'id' => 'timestamp', 'name' => 'timestamp', 'default' => '', 'classes' => array(), 'label' => __('Timestamp (ago)', kopa_get_domain()), 'help' => NULL, 'options' => array('' => __('-- Select --', kopa_get_domain()), '-1 week' => __('1 week', kopa_get_domain()), '-2 week' => __('2 weeks', kopa_get_domain()), '-3 week' => __('3 weeks', kopa_get_domain()), '-1 month' => __('1 months', kopa_get_domain()), '-2 month' => __('2 months', kopa_get_domain()), '-3 month' => __('3 months', kopa_get_domain()), '-4 month' => __('4 months', kopa_get_domain()), '-5 month' => __('5 months', kopa_get_domain()), '-6 month' => __('6 months', kopa_get_domain()), '-7 month' => __('7 months', kopa_get_domain()), '-8 month' => __('8 months', kopa_get_domain()), '-9 month' => __('9 months', kopa_get_domain()), '-10 month' => __('10 months', kopa_get_domain()), '-11 month' => __('11 months', kopa_get_domain()), '-1 year' => __('1 year', kopa_get_domain()), '-2 year' => __('2 years', kopa_get_domain()), '-3 year' => __('3 years', kopa_get_domain()), '-4 year' => __('4 years', kopa_get_domain()), '-5 year' => __('5 years', kopa_get_domain()), '-6 year' => __('6 years', kopa_get_domain()), '-7 year' => __('7 years', kopa_get_domain()), '-8 year' => __('8 years', kopa_get_domain()), '-9 year' => __('9 years', kopa_get_domain()), '-10 year' => __('10 years', kopa_get_domain()))); $this->groups['col-1'] = $g_style; $this->groups['col-2'] = $g_query; }
/** * * @package Kopa * @subpackage Core * @author thethangtran <*****@*****.**> * @since 1.0.0 * */ function kopa_options_contact() { $groups['info'] = array('icon' => '', 'title' => __('Contact Infomation', kopa_get_domain()), 'fields' => array()); $groups['info']['fields'][] = array('type' => 'text', 'id' => 'contact_info_caption', 'name' => 'contact_info_caption', 'label' => __('Caption', kopa_get_domain()), 'help' => '', 'classes' => array('linedtextarea'), 'default' => __('Contact information', kopa_get_domain())); $groups['info']['fields'][] = array('type' => 'textarea', 'id' => 'contact_info_description', 'name' => 'contact_info_description', 'label' => __('Descripton', kopa_get_domain()), 'help' => '', 'classes' => array('linedtextarea'), 'attributes' => array('rows' => 10), 'default' => ''); $groups['info']['fields'][] = array('type' => 'text', 'id' => 'contact_phone', 'name' => 'contact_phone', 'label' => __('Phone number', kopa_get_domain()), 'default' => ''); $groups['info']['fields'][] = array('type' => 'text', 'id' => 'contact_fax', 'name' => 'contact_fax', 'label' => __('Fax number', kopa_get_domain()), 'default' => ''); $groups['info']['fields'][] = array('type' => 'text', 'id' => 'contact_email', 'name' => 'contact_email', 'label' => __('Email(s)', kopa_get_domain()), 'default' => ''); $groups['info']['fields'][] = array('type' => 'text', 'id' => 'contact_address', 'name' => 'contact_address', 'label' => __('Address', kopa_get_domain()), 'default' => ''); $groups['info']['fields'][] = array('type' => 'text', 'id' => 'contact_map', 'name' => 'contact_map', 'label' => __('Google Map', kopa_get_domain()), 'help' => sprintf('Enter your google map code <code>latitude,longitude</code>. Example: <code>40.722868,-73.99739</code>. %s <a target="_blank" href="https://db.tt/p77FqjZC">%s</a>.', __('How to get it? Click', kopa_get_domain()), __('here', kopa_get_domain())), 'default' => '40.722868,-73.99739'); $groups['info']['fields'][] = array('type' => 'media', 'id' => 'contact_map_marker', 'name' => 'contact_map_marker', 'label' => __('Gmap Marker', kopa_get_domain()), 'help' => __('You can download, and edit marker image from PSD file. Download <a href="https://db.tt/qssyQ4pY" target="_blank">here</a>', kopa_get_domain()), 'default' => get_template_directory_uri() . '/images/marker.png'); /* * -------------------------------------------------- * CONTACT FORM * -------------------------------------------------- */ $groups['form'] = array('icon' => '', 'title' => __('Contact Form', kopa_get_domain()), 'fields' => array()); $groups['form']['fields'][] = array('type' => 'text', 'id' => 'contact_form_caption', 'name' => 'contact_form_caption', 'label' => __('Caption', kopa_get_domain()), 'help' => '', 'classes' => array('linedtextarea'), 'default' => __('Contact form', kopa_get_domain())); $groups['form']['fields'][] = array('type' => 'textarea', 'id' => 'contact_form_description', 'name' => 'contact_form_description', 'label' => __('Descripton', kopa_get_domain()), 'help' => '', 'classes' => array('linedtextarea'), 'attributes' => array('rows' => 10), 'default' => ''); $groups['form']['fields'][] = array('type' => 'group', 'id' => 'recaptcha', 'name' => 'recaptcha', 'label' => __('reCaptcha', kopa_get_domain()), 'default' => '', 'sub_fields' => array(array('type' => 'select', 'id' => 'recaptcha_skin', 'name' => 'recaptcha_skin', 'label' => __('<code>SKIN</code>', kopa_get_domain()), 'help' => __('To view skins preview, click <a target="_blank" href="https://db.tt/cYvusoxp">here</a>.<br/>To create your public & private key, click <a target="_blank" href="http://www.google.com/recaptcha/whyrecaptcha">here</a>', kopa_get_domain()), 'default' => 'clean', 'value' => KopaOptions::get_option('recaptcha_skin', 'clean'), 'options' => array('off' => __('-- Hide --', kopa_get_domain()), 'clean' => __('Clean', kopa_get_domain()), 'red' => __('Red', kopa_get_domain()), 'white' => __('White', kopa_get_domain()), 'blackglass' => __('Black glass', kopa_get_domain())), 'classes' => array('kopa_sub_field_control', 'kopa_recaptcha_skin'), 'wrap_begin' => '<div class="kopa_sub_field_wrap">', 'wrap_end' => '</div>', 'label_begin' => '<div>', 'label_end' => '</div>', 'attributes' => array('onchange' => 'KopaThemeOptions.onChangeReCaptchaSkin(event, jQuery(this));')), array('type' => 'text', 'id' => 'recaptcha_public_key', 'name' => 'recaptcha_public_key', 'value' => KopaOptions::get_option('recaptcha_public_key'), 'default' => '6Lc6ou4SAAAAAF2yR3zRLTSljpTCPpdFRqWD5wXt', 'label' => __('<code>PUBLIC KEY</code>', kopa_get_domain()), 'classes' => array('kopa_sub_field_control'), 'wrap_begin' => '<div class="kopa_sub_field_wrap">', 'wrap_end' => '</div>'), array('type' => 'text', 'id' => 'recaptcha_private_key', 'name' => 'recaptcha_private_key', 'value' => KopaOptions::get_option('recaptcha_private_key'), 'default' => '6Lc6ou4SAAAAAO1_5edZqUythRWLGxgHGyDTYRUJ', 'label' => __('<code>PRIVATE KEY</code>', kopa_get_domain()), 'classes' => array('kopa_sub_field_control'), 'wrap_begin' => '<div class="kopa_sub_field_wrap">', 'wrap_end' => '</div>'))); $groups['form']['fields'][] = array('type' => 'textarea', 'id' => 'contact_reply_template', 'name' => 'contact_reply_template', 'label' => __('Mail Reply Template', kopa_get_domain()), 'help' => 'Variable: <code>[contact_name]</code>, <code>[contact_email]</code>, <code>[contact_message]</code>', 'classes' => array('linedtextarea'), 'attributes' => array('rows' => 10), 'default' => '<p>Aloha!</p> <p>You have a new message from [contact_name] ([contact_email])</p> <div>[contact_message]</div> <p>Thanks!</p>'); return apply_filters('kopa_options_contact', $groups); }
/** * * * @package Kopa * @subpackage Core * @author thethangtran <*****@*****.**> * @since 1.0.0 * */ protected function get_control() { $this->classes[] = 'kopa-ui-sidebar-manager'; $this->classes[] = 'clearfix'; $this->set_attribute('autocomplete', 'off'); $html = sprintf('<div class="%s">', implode(' ', $this->classes)); $html .= sprintf('<p class="kopa-sidebar-sub-caption">%s</p>', __('Add your sidebars below and then you can assign one of these sidebars from the individual posts, pages or archive, ..', kopa_get_domain())); $html .= '<p>'; $html .= '<input type="text" class="form-control txt_sidebar_name" name="txt_sidebar_name" id="txt_sidebar_name" autocomplete="off">'; $html .= sprintf('<a href="#" class="btn btn-primary btn-add-sidebar" onclick="KopaSidebar.add(event, jQuery(this), jQuery(\'#txt_sidebar_name\'));"><span>%s</span></a>', __('Add sidebar', kopa_get_domain())); $html .= '</p>'; $html .= '<table class="table table-responsive table-hover table-list-sidebar">'; $html .= '<thead>'; $html .= '<tr>'; $html .= sprintf('<th class="col-xs-10">%s</th>', __('Sidebar name', kopa_get_domain())); $html .= sprintf('<th class="col-xs-1">%s</th>', __('Rename', kopa_get_domain())); $html .= sprintf('<th class="col-xs-1">%s</th>', __('Remove', kopa_get_domain())); $html .= '</tr>'; $html .= '</thead>'; $html .= '<tbody>'; foreach ($this->value as $slug => $title) { if ('sidebar_hide' != $slug) { $html .= '<tr>'; $html .= sprintf('<td><span>%s<span></td>', $title); $html .= sprintf('<td><a href="#" onclick="KopaSidebar.rename(event, jQuery(this),\'%s\');" class="btn btn-success btn-sm"><i class="dashicons dashicons-edit"></i></a></td>', $slug); $html .= sprintf('<td><a href="#" onclick="KopaSidebar.remove(event, jQuery(this),\'%s\',\'%s\');" class="btn btn-danger btn-sm"><i class="dashicons dashicons-no-alt"></i></a></td>', $slug, $title); $html .= '</tr>'; } } $html .= '</tbody>'; $html .= '</table>'; $html .= '</div>'; return $html; }
/** * * * @package Kopa * @subpackage Core * @author thethangtran <*****@*****.**> * @since 1.0.0 * */ public static function get_title() { $title = ''; $pattern = ''; if (is_main_query() && 'true' == KopaOptions::get_option('seo_status', 'true')) { $pattern = '[site_name] - [site_desc]'; if (is_archive()) { if (is_tag() || is_category()) { $pattern = KopaOptions::get_option('seo_title_taxonomy', '[term_type] - [term_name] - [pagination_paged] - [site_name]'); } else { if (is_author()) { $pattern = KopaOptions::get_option('seo_title_author', 'Posts created by [author_name] - [site_name]'); } } } else { if (is_search()) { $pattern = KopaOptions::get_option('seo_title_search', 'Search pages: You searched for [search_phrase] return [search_result_count] results - [site_name]'); } else { if (is_singular()) { if (is_page()) { $pattern = KopaOptions::get_option('seo_title_page', '[page_name] - [site_name]'); if (is_front_page()) { $pattern = KopaOptions::get_option('seo_title_front_page', '[site_name] - [site_desc]'); } } else { if (is_single()) { $pattern = KopaOptions::get_option('seo_title_post', '[post_name] - Created by [post_author_name] - In category: [post_cats] - Tagged with: [post_tags] - [site_name] - [site_desc]'); } } } else { if (is_404()) { $pattern = KopaOptions::get_option('seo_title_404', 'Oops! 404 Page not found - [site_name] - [site_desc]'); } else { if (is_home()) { $pattern = KopaOptions::get_option('seo_title_home_page', 'Latest News - [pagination_paged] - [site_name] - [site_desc]'); } } } } } } if (empty($pattern)) { global $page, $paged; $title = wp_title('|', FALSE, 'right'); $title .= get_bloginfo('name'); $site_description = get_bloginfo('description', 'display'); if ($site_description && (is_home() || is_front_page())) { $title .= " | {$site_description}"; } if ($paged >= 2 || $page >= 2) { $title .= ' | ' . sprintf(__('Page %s', kopa_get_domain()), max($paged, $page)); } } else { $title = do_shortcode($pattern); } return apply_filters('kopa_seo_get_title', $title); }
/** * * * @package Kopa * @subpackage Core * @author thethangtran <*****@*****.**> * @since 1.0.0 * */ protected function get_control() { $this->classes[] = 'kopa-ui-taxonomy'; $terms = get_terms($this->taxonomy); $this->options[''] = __('-- Select --', kopa_get_domain()); foreach ($terms as $term) { $this->options[$term->term_id] = $term->name; } return parent::get_control(); }
/** * * * @package Kopa * @subpackage Core * @author thethangtran <*****@*****.**> * @since 1.0.0 * */ public function __construct($args = array()) { parent::__construct($args); $this->options = array(); $pages = get_pages(array('sort_order' => 'ASC', 'sort_column' => 'post_title', 'hierarchical' => 1, 'exclude' => '', 'include' => '', 'meta_key' => '', 'meta_value' => '', 'authors' => '', 'child_of' => 0, 'parent' => -1, 'exclude_tree' => '', 'number' => '', 'offset' => 0, 'post_type' => 'page', 'post_status' => 'publish')); $this->options[0] = __('-- Select Page --', kopa_get_domain()); foreach ($pages as $page) { $this->options[$page->ID] = $page->post_title; } }
/** * * * @package Kopa * @subpackage Core * @author thethangtran <*****@*****.**> * @since 1.0.0 * */ function kopa_shortcode_pagination_paged($atts, $content = null) { $pagination_paged = ''; if (is_archive() || is_home()) { global $page, $paged; $current_page = (int) max($paged, $page); $pagination_paged = sprintf(__('Page %s', kopa_get_domain()), $current_page > 0 ? $current_page : 1); } return apply_filters('kopa_shortcode_pagination_paged', $pagination_paged); }
/** * * @package Kopa * @subpackage Core * @author thethangtran <*****@*****.**> * @since 1.0.0 * */ function kopa_options_color_scheme() { $groups['main-color'] = array('icon' => '', 'title' => __('Pre defined colors', kopa_get_domain()), 'fields' => array()); $groups['main-color']['fields'][] = array('type' => 'color-swatches-single', 'id' => 'colors', 'name' => 'colors', 'label' => NULL, 'help' => '', 'default' => '#D40202', 'control_begin' => '<div class="col-xs-12">', 'control_end' => '</div>', 'colors' => array(array('primary' => '#D40202', 'label' => NULL, 'classes' => array()), array('primary' => 'customize', 'label' => '<i class="dashicons dashicons-plus"></i>', 'classes' => array('color-swatches-single-custom')))); /** * CUSTOM COLORS */ $groups['custom-color'] = array('icon' => '', 'title' => __('Custom colors', kopa_get_domain()), 'fields' => array()); $groups['custom-color']['fields'][] = array('type' => 'color', 'id' => 'primary_color', 'name' => 'primary_color', 'label' => __('Primary color', kopa_get_domain()), 'help' => '', 'default' => '#D40202', 'classes' => array('mc-primary')); return apply_filters('kopa_options_styling', $groups); }
/** * * @package Kopa * @subpackage Core * @author thethangtran <*****@*****.**> * @since 1.0.0 * */ function kopa_options_social_links() { $groups['social-links'] = array('icon' => '', 'title' => __('Social Links', kopa_get_domain()), 'fields' => array()); $social_icons = KopaInit::get_social_icons(); if ($social_icons) { foreach ($social_icons as $slug => $info) { $groups['social-links']['fields'][] = array('type' => 'text', 'id' => "social_link_{$slug}", 'name' => "social_link_{$slug}", 'label' => sprintf('%s <i class="%s kps-iconmoon pull-right" style="color:%s"></i>', $info['title'], $info['icon'], $info['color']), 'help' => isset($info['help']) ? $info['help'] : '', 'default' => ''); } } return apply_filters('kopa_options_social_links', $groups); }
public function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); echo $before_widget; if (!empty($title)) { echo $before_title . $title . $after_title; } $instance['orderby'] = 'popular'; $instance['posts_per_page'] = 5; $query = $this->build_query($instance); $posts = new WP_Query($query); if ($posts->have_posts()) { ?> <div class="widget-content"> <ul class="list-unstyled"> <?php $loop_index = 0; while ($posts->have_posts()) { $posts->the_post(); $post_id = get_the_ID(); $percent = 100 - $loop_index * 10; ?> <li> <div class="item clearfix" style="width: <?php echo $percent; ?> %;"> <h4 class="post-title" ><a href="<?php echo get_permalink(); ?> "><?php echo get_the_title(); ?> </a></h4> <span><?php echo KopaUtil::get_views($post_id); ?> </span> </div> </li> <?php $loop_index++; } ?> </ul> </div> <?php } else { _e('Posts not found. Pleae config this widget again!', kopa_get_domain()); } wp_reset_postdata(); echo $after_widget; }
/** * * * @package Kopa * @subpackage Core * @author thethangtran <*****@*****.**> * @since 1.0.0 * */ protected function get_control() { $html = ''; if ($this->template_hierarchy) { $this->value = is_array($this->value) ? $this->value : unserialize($this->value); $html = KopaLayout::get_form($this->template_hierarchy, $this->value, $this->name); } else { $html = __('Parameter template_hierarchy is missing.', kopa_get_domain()); } return $html; }
/** * * @package Kopa * @subpackage Core * @author thethangtran <*****@*****.**> * @since 1.0.0 * */ function kopa_options_elements() { $groups['lightbox'] = array('icon' => '', 'title' => __('Lightbox (Pretty Photo)', kopa_get_domain()), 'fields' => array()); $groups['lightbox']['fields'][] = array('type' => 'radio-truefalse', 'id' => 'is_play_video_on_lightbox', 'name' => 'is_play_video_on_lightbox', 'label' => __('Play video on lighbox', kopa_get_domain()), 'help' => NULL, 'default' => 'true', 'true' => __('Yes', kopa_get_domain()), 'false' => __('No', kopa_get_domain())); $groups['lightbox']['fields'][] = array('type' => 'select', 'id' => 'lightbox_skin', 'name' => 'lightbox_skin', 'label' => __('Skin', kopa_get_domain()), 'help' => NULL, 'default' => 'pp_default', 'options' => array('pp_default' => __('Default', kopa_get_domain()), 'facebook' => __('Facebook', kopa_get_domain()), 'dark_rounded' => __('Dark rounded', kopa_get_domain()), 'dark_square' => __('Dark square', kopa_get_domain()), 'light_rounded' => __('Light rounded', kopa_get_domain()), 'light_square' => __('Light square', kopa_get_domain()))); $groups['lightbox']['fields'][] = array('type' => 'radio-truefalse', 'id' => 'is_lightbox_modal_mode', 'name' => 'is_lightbox_modal_mode', 'label' => __('Modal mode', kopa_get_domain()), 'help' => __('If set to Yes, only the close button will close the window', kopa_get_domain()), 'default' => 'true', 'true' => __('Enable', kopa_get_domain()), 'false' => __('Disable', kopa_get_domain())); $groups['lightbox']['fields'][] = array('type' => 'radio-truefalse', 'id' => 'is_lightbox_show_title', 'name' => 'is_lightbox_show_title', 'label' => __('Title', kopa_get_domain()), 'default' => 'true', 'true' => __('Show', kopa_get_domain()), 'false' => __('Hide', kopa_get_domain())); $groups['lightbox']['fields'][] = array('type' => 'radio-truefalse', 'id' => 'is_lightbox_social_tools', 'name' => 'is_lightbox_social_tools', 'label' => __('Sharing with Facebook, Twitter', kopa_get_domain()), 'default' => 'true', 'true' => __('Show', kopa_get_domain()), 'false' => __('Hide', kopa_get_domain())); $groups['lightbox']['fields'][] = array('type' => 'select-number', 'id' => 'lightbox_opacity', 'name' => 'lightbox_opacity', 'label' => __('Overlay Opacity', kopa_get_domain()), 'help' => __('Value between 0% and 100%', kopa_get_domain()), 'default' => 70, 'min' => 0, 'max' => 100, 'step' => 5, 'suffix' => '%'); return apply_filters('kopa_options_lightbox', $groups); }
/** * * @package Kopa * @subpackage Core * @author thethangtran <*****@*****.**> * @since 1.0.0 * */ function kopa_options_blog_posts() { $groups['archive'] = array('icon' => '', 'title' => __('Blog post', kopa_get_domain()), 'fields' => array()); $groups['archive']['fields'][] = array('type' => 'radio-list', 'id' => 'exceprt_type', 'name' => 'exceprt_type', 'label' => __('For each article in list, show', kopa_get_domain()), 'default' => 'excerpt', 'help' => '', 'options' => array(array('value' => 'excerpt', 'label' => __('Excerpt', kopa_get_domain())), array('value' => 'full', 'label' => __('Full content', kopa_get_domain())), array('value' => 'limit', 'label' => __('Limit number characters', kopa_get_domain()), 'sub_fields' => array(array('type' => 'number', 'id' => 'excerpt_limit', 'name' => 'excerpt_limit', 'default' => 200, 'value' => KopaOptions::get_option('excerpt_limit', 200))))), 'option_args' => array('wrap_begin' => '<div class="row cleafix"><div class="col-xs-12">', 'wrap_end' => '</div></div>', 'label_begin' => '', 'label_end' => '', 'control_begin' => '', 'control_end' => '')); $groups['archive']['fields'][] = array('type' => 'radio-truefalse', 'id' => 'is_display_blog_post_format', 'name' => 'is_display_blog_post_format', 'value' => 'false', 'default' => 'false', 'label' => __('Display content formatted', kopa_get_domain()), 'help_classes' => '', 'help' => __('If value is <code>Yes</code>, thumbnails has been replaced by video, audio or gallery shortcode', kopa_get_domain()), 'true' => __('Yes', kopa_get_domain()), 'false' => __('No', kopa_get_domain())); $groups['archive']['fields'][] = array('type' => 'radio-truefalse', 'id' => 'is_display_created_date', 'name' => 'is_display_created_date', 'value' => 'true', 'default' => 'true', 'label' => __('Created Date', kopa_get_domain()), 'help_classes' => array(), 'true' => __('Show', kopa_get_domain()), 'false' => __('Hide', kopa_get_domain())); $groups['archive']['fields'][] = array('type' => 'radio-truefalse', 'id' => 'is_display_comments', 'name' => 'is_display_comments', 'value' => 'true', 'default' => 'true', 'label' => __('Number of comments', kopa_get_domain()), 'help_classes' => array(), 'true' => __('Show', kopa_get_domain()), 'false' => __('Hide', kopa_get_domain())); $groups['archive']['fields'][] = array('type' => 'radio-truefalse', 'id' => 'is_display_views', 'name' => 'is_display_views', 'value' => 'true', 'default' => 'true', 'label' => __('Number of views', kopa_get_domain()), 'help_classes' => array(), 'true' => __('Show', kopa_get_domain()), 'false' => __('Hide', kopa_get_domain())); $groups['archive']['fields'][] = array('type' => 'radio-truefalse', 'id' => 'is_display_likes', 'name' => 'is_display_likes', 'value' => 'true', 'default' => 'true', 'label' => __('Number of likes', kopa_get_domain()), 'help_classes' => array(), 'true' => __('Show', kopa_get_domain()), 'false' => __('Hide', kopa_get_domain())); $groups['archive']['fields'][] = array('type' => 'radio-truefalse', 'id' => 'is_display_readmore', 'name' => 'is_display_readmore', 'value' => 'true', 'default' => 'true', 'label' => __('Read more button', kopa_get_domain()), 'help_classes' => array(), 'true' => __('Show', kopa_get_domain()), 'false' => __('Hide', kopa_get_domain())); return apply_filters('kopa_options_blog_posts', $groups); }
/** * * * @package Kopa * @subpackage Core * @author thethangtran <*****@*****.**> * @since 1.0.0 * */ protected function get_control() { $this->classes[] = 'kopa-ui-icon'; $this->classes[] = 'form-control'; $this->set_attribute('autocomplete', 'off'); $html = sprintf('<input type="hidden" id="%s" name="%s" class="%s" value="%s" %s/>', $this->id, $this->name, implode(' ', $this->classes), $this->value, $this->unserialize_attributes()); if ($this->value) { $html .= sprintf('<i class="kopa-ui-icon-preview %s"></i>', $this->value); } $html .= sprintf('<a class="btn btn-sm btn-warning kopa-ui-icon-remove" onclick="KopaUI.remove_icon(event, jQuery(this));" style="display: %s;">%s</a>', $this->value ? 'inline-block' : 'none;', __('Remove', kopa_get_domain())); $html .= sprintf('<a href="#" class="btn btn-sm btn-primary kopa-ui-icon-select" onclick="KopaUI.open_iconList(event, jQuery(this));" style="display: %s;">%s</a>', $this->value ? 'none' : 'inline-block;', __('Select', kopa_get_domain())); return $html; }
/** * * * @package Kopa * @subpackage Core * @author thethangtran <*****@*****.**> * @since 1.0.0 * */ private function _clone($id = '', $value = '') { $id = empty($id) ? 'multi-text-index-' . wp_generate_password(10, false, false) : $id; $out = '<li class="multi-text-element clearfix">'; $out .= sprintf('<i class="btn btn-xs btn-primary multi-text-drag kopa-sortable-handle">%s</i>', __('drag', kopa_get_domain())); $out .= sprintf('<span class="btn btn-primary multi-text-add btn-xs" onclick="KopaUI.add_multitext(event, jQuery(this));">%1$s</span>', __('add', kopa_get_domain())); $out .= sprintf('<span class="btn btn-danger multi-text-del btn-xs" onclick="KopaUI.del_multitext(event, jQuery(this));">%1$s</span>', __('del', kopa_get_domain())); $out .= '<div class="clearfix"></div>'; $out .= sprintf('<input type="hidden" class="id" name="%1$s[id][]" value="%2$s" autocomplete="off"/>', $this->name, $id); $out .= sprintf('<input type="text" class="form-control multi-text-value" name="%1$s[value][]" value="%2$s" autocomplete="off"/>', $this->name, $value); $out .= '</li>'; return $out; }
public function __construct($id_base = '', $name = '', $widget_options = array(), $control_options = array()) { $id_base = 'kopa_flickr'; $name = __('Kopa Flickr', kopa_get_domain()); $widget_options = array('classname' => 'widget-flickr', 'description' => __('Display list photo from flickr', kopa_get_domain())); $control_options = array('width' => 'auto', 'height' => 'auto'); parent::__construct($id_base, $name, $widget_options, $control_options); $col_1 = array('size' => 12, 'fields' => array()); $col_1['fields']['title'] = array('type' => 'text', 'id' => 'title', 'name' => 'title', 'default' => '', 'classes' => array(), 'label' => __('Title', kopa_get_domain()), 'help' => NULL); $col_1['fields']['id'] = array('type' => 'text', 'id' => 'id', 'name' => 'id', 'default' => '71865026@N00', 'classes' => array(), 'label' => __('ID', kopa_get_domain()), 'help' => sprintf(__('Get your flickr ID. Click <a href="%s" target="_blank">here</a>', kopa_get_domain()), 'http://idgettr.com/')); $col_1['fields']['limit'] = array('type' => 'number', 'id' => 'limit', 'name' => 'limit', 'default' => '12', 'classes' => array(), 'label' => __('Number of photos', kopa_get_domain()), 'help' => NULL); $this->groups['col-1'] = $col_1; }
/** * * * @package Kopa * @subpackage Core * @author thethangtran <*****@*****.**> * @since 1.0.0 * */ public function __construct($args = array()) { parent::__construct($args); $this->options = array(array('value' => 'true', 'label' => isset($args['true']) ? $args['true'] : __('True', kopa_get_domain())), array('value' => 'false', 'label' => isset($args['false']) ? $args['false'] : __('False', kopa_get_domain()))); $this->control_begin = $this->control_begin . '<div class="row clearfix">'; $this->control_end = '</div>' . $this->control_end; $this->option_args['wrap_begin'] = '<div class="col-xs-4 col-sm-4 col-md-2">'; $this->option_args['wrap_end'] = '</div>'; $this->option_args['label_begin'] = ''; $this->option_args['label_end'] = ''; $this->option_args['control_begin'] = ''; $this->option_args['control_end'] = ''; }
/** * * @package Kopa * @subpackage Core * @author thethangtran <*****@*****.**> * @since 1.0.0 * */ function kopa_options_single_post() { /* * ------------------------------------------------------------ * METADATA * ------------------------------------------------------------ */ $groups['metadata'] = array('icon' => '', 'title' => __('Metadata', kopa_get_domain()), 'fields' => array()); $groups['metadata']['fields'][] = array('type' => 'radio-truefalse', 'id' => 'is_display_post_thumbnail_standard', 'name' => 'is_display_post_thumbnail_standard', 'value' => 'true', 'default' => 'true', 'label' => __('Thumbnail (standard post)', kopa_get_domain()), 'help' => '', 'true' => __('Show', kopa_get_domain()), 'false' => __('Hide', kopa_get_domain())); $groups['metadata']['fields'][] = array('type' => 'radio-truefalse', 'id' => 'is_display_post_thumbnail_other', 'name' => 'is_display_post_thumbnail_other', 'value' => 'false', 'default' => 'false', 'label' => __('Thumbnail (other format)', kopa_get_domain()), 'help' => __('Other format e.g. <code>Video</code> <code>Audio</code> <code>Gallery</code> <code>Aside</code> <code>Quote</code> <code>Status</code> ...', kopa_get_domain()), 'help_classes' => array(), 'true' => __('Show', kopa_get_domain()), 'false' => __('Hide', kopa_get_domain())); $groups['metadata']['fields'][] = array('type' => 'radio-truefalse', 'id' => 'is_display_post_category', 'name' => 'is_display_post_category', 'value' => 'true', 'default' => 'true', 'label' => __('Categories', kopa_get_domain()), 'help' => '', 'true' => __('Show', kopa_get_domain()), 'false' => __('Hide', kopa_get_domain())); $groups['metadata']['fields'][] = array('type' => 'radio-truefalse', 'id' => 'is_display_post_tag', 'name' => 'is_display_post_tag', 'value' => 'true', 'default' => 'true', 'label' => __('Tags', kopa_get_domain()), 'help' => '', 'true' => __('Show', kopa_get_domain()), 'false' => __('Hide', kopa_get_domain())); $groups['metadata']['fields'][] = array('type' => 'radio-truefalse', 'id' => 'is_display_post_datetime', 'name' => 'is_display_post_datetime', 'value' => 'true', 'default' => 'true', 'label' => __('Created date', kopa_get_domain()), 'help' => '', 'true' => __('Show', kopa_get_domain()), 'false' => __('Hide', kopa_get_domain())); $groups['metadata']['fields'][] = array('type' => 'radio-truefalse', 'id' => 'is_display_post_comments', 'name' => 'is_display_post_comments', 'value' => 'true', 'default' => 'true', 'label' => __('Number of comments', kopa_get_domain()), 'help' => '', 'true' => __('Show', kopa_get_domain()), 'false' => __('Hide', kopa_get_domain())); $groups['metadata']['fields'][] = array('type' => 'radio-truefalse', 'id' => 'is_display_post_views', 'name' => 'is_display_post_views', 'value' => 'true', 'default' => 'true', 'label' => __('Number of views', kopa_get_domain()), 'help' => '', 'true' => __('Show', kopa_get_domain()), 'false' => __('Hide', kopa_get_domain())); $groups['metadata']['fields'][] = array('type' => 'radio-truefalse', 'id' => 'is_display_post_likes', 'name' => 'is_display_post_likes', 'value' => 'true', 'default' => 'true', 'label' => __('Number of likes', kopa_get_domain()), 'help' => '', 'true' => __('Show', kopa_get_domain()), 'false' => __('Hide', kopa_get_domain())); $groups['metadata']['fields'][] = array('type' => 'radio-truefalse', 'id' => 'is_display_post_shares', 'name' => 'is_display_post_shares', 'value' => 'true', 'default' => 'true', 'label' => __('Share buttons', kopa_get_domain()), 'help' => '', 'true' => __('Show', kopa_get_domain()), 'false' => __('Hide', kopa_get_domain())); /* * ------------------------------------------------------------ * AUTHOR * ------------------------------------------------------------ */ $groups['author'] = array('icon' => '', 'title' => __('Author', kopa_get_domain()), 'fields' => array()); $groups['author']['fields'][] = array('type' => 'radio-truefalse', 'id' => 'is_display_post_author_information', 'name' => 'is_display_post_author_information', 'value' => 'true', 'default' => 'true', 'label' => __('Author information', kopa_get_domain()), 'help' => '', 'true' => __('Show', kopa_get_domain()), 'false' => __('Hide', kopa_get_domain())); $groups['author']['fields'][] = array('type' => 'radio-truefalse', 'id' => 'is_display_post_author_social_links', 'name' => 'is_display_post_author_social_links', 'value' => 'true', 'default' => 'true', 'label' => __('Author social links', kopa_get_domain()), 'help' => '', 'true' => __('Show', kopa_get_domain()), 'false' => __('Hide', kopa_get_domain())); /* * ------------------------------------------------------------ * PREV & NEXT POSTS * ------------------------------------------------------------ */ $groups['prev-next-links'] = array('icon' => '', 'title' => __('Previous & Next Post Links', kopa_get_domain()), 'fields' => array()); $groups['prev-next-links']['fields'][] = array('type' => 'radio-truefalse', 'id' => 'is_display_post_prev_next_links', 'name' => 'is_display_post_prev_next_links', 'value' => 'true', 'default' => 'true', 'label' => __('Prev & next post links', kopa_get_domain()), 'help' => '', 'true' => __('Show', kopa_get_domain()), 'false' => __('Hide', kopa_get_domain())); $groups['prev-next-links']['fields'][] = array('type' => 'radio-truefalse', 'id' => 'is_display_post_prev_next_links_same_cat', 'name' => 'is_display_post_prev_next_links_same_cat', 'value' => 'true', 'default' => 'true', 'label' => __('Is same category', kopa_get_domain()), 'help' => '', 'true' => __('Yes', kopa_get_domain()), 'false' => __('No', kopa_get_domain())); /* * ------------------------------------------------------------ * RELATED POSTS * ------------------------------------------------------------ */ $groups['related-posts'] = array('icon' => '', 'title' => __('Related Post', kopa_get_domain()), 'fields' => array()); $groups['related-posts']['fields'][] = array('type' => 'select', 'id' => 'post_related_posts_get_by', 'name' => 'post_related_posts_get_by', 'value' => 'post_tag', 'default' => 'post_tag', 'label' => __('Get by', kopa_get_domain()), 'help' => '', 'options' => array('category' => __('Category', kopa_get_domain()), 'post_tag' => __('Tag', kopa_get_domain()))); $groups['related-posts']['fields'][] = array('type' => 'select-number', 'id' => 'post_related_posts_limit', 'name' => 'post_related_posts_limit', 'label' => __('Number of posts', kopa_get_domain()), 'help' => __('Select <code>0</code> to hide this section.', kopa_get_domain()), 'default' => 4, 'min' => 0, 'max' => 40, 'step' => 1); /* * ------------------------------------------------------------ * COMMENTS * ------------------------------------------------------------ */ $groups['comments'] = array('icon' => '', 'title' => __('Comment System', kopa_get_domain()), 'fields' => array()); $groups['comments']['fields'][] = array('type' => 'radio-truefalse', 'id' => 'is_display_post_comments_system', 'name' => 'is_display_post_comments_system', 'value' => 'true', 'default' => 'true', 'label' => __('Default comment system', kopa_get_domain()), 'help' => '', 'true' => __('Show', kopa_get_domain()), 'false' => __('Hide', kopa_get_domain())); return apply_filters('kopa_options_single_post', $groups); }
/** * * @package Kopa * @subpackage Core * @author thethangtran <*****@*****.**> * @since 1.0.0 * */ function kopa_options_seo() { /* * SEO * **************************** */ $groups['seo'] = array('icon' => '', 'title' => __('SEO - Search engine optimization', kopa_get_domain()), 'fields' => array()); $groups['seo']['fields'][] = array('type' => 'radio-truefalse', 'id' => 'seo_status', 'name' => 'seo_status', 'value' => 'true', 'default' => 'true', 'label' => __('Status', kopa_get_domain()), 'help' => __('If you using any SEO Plugin, please disable this option.', kopa_get_domain()), 'true' => __('Enable', kopa_get_domain()), 'false' => __('Disable', kopa_get_domain()), 'attributes' => array('onclick' => 'KopaThemeOptions.onClickSEOStatus(event, jQuery(this));'), 'option_args' => array('classes' => array('rdo_seo_status'))); $seo_keys = array(); $seo_keys['site_name'] = __('Your site name', kopa_get_domain()); $seo_keys['site_desc'] = __('Your site description', kopa_get_domain()); $seo_keys['term_type'] = __('Type of term. E.g. category, post_tag', kopa_get_domain()); $seo_keys['term_name'] = __('Name of category or tag', kopa_get_domain()); $seo_keys['pagination_paged'] = __('Number of current page', kopa_get_domain()); $seo_keys['page_name'] = __('Name of current page', kopa_get_domain()); $seo_keys['post_name'] = __('Name of current post', kopa_get_domain()); $seo_keys['post_author_name'] = __('Author of current post(page)', kopa_get_domain()); $seo_keys['post_cats'] = __('Categories of current post', kopa_get_domain()); $seo_keys['post_tags'] = __('Tags of current post', kopa_get_domain()); $seo_keys['author_name'] = __('Name of current author (author page)', kopa_get_domain()); $seo_keys['search_phrase'] = __('Search keyword', kopa_get_domain()); $seo_keys['search_result_count'] = __('Number of search results', kopa_get_domain()); $seo_keys_help = array(); foreach ($seo_keys as $key => $desc) { $seo_keys_help[] = sprintf('<span class="kopa_seo_title_key"><code>[%s]</code></span>%s', $key, $desc); } $groups['seo']['fields'][] = array('type' => 'group', 'id' => 'seo_titles', 'name' => 'seo_titles', 'label' => __('Title', kopa_get_domain()), 'default' => '', 'help' => implode('<br/>', $seo_keys_help), 'sub_fields' => array(array('type' => 'text', 'id' => 'seo_title_front_page', 'name' => 'seo_title_front_page', 'value' => KopaOptions::get_option('seo_title_front_page', '[site_name] - [site_desc]'), 'default' => '[site_name] - [site_desc]', 'label' => __('<code>HOME</code>', kopa_get_domain()), 'classes' => array('kopa_sub_field_control'), 'wrap_begin' => '<div class="kopa_sub_field_wrap">', 'wrap_end' => '</div>', 'help' => __('Front Page (it\'s static page)', kopa_get_domain())), array('type' => 'text', 'id' => 'seo_title_home_page', 'name' => 'seo_title_home_page', 'value' => KopaOptions::get_option('seo_title_home_page', 'Latest News - [pagination_paged] - [site_name] - [site_desc]'), 'default' => 'Latest News - [pagination_paged] - [site_name] - [site_desc]', 'label' => __('<code>HOME</code>', kopa_get_domain()), 'classes' => array('kopa_sub_field_control'), 'wrap_begin' => '<div class="kopa_sub_field_wrap">', 'wrap_end' => '</div>', 'help' => __('Blog posts (display latest posts with pagination)', kopa_get_domain())), array('type' => 'text', 'id' => 'seo_title_taxonomy', 'name' => 'seo_title_taxonomy', 'value' => KopaOptions::get_option('seo_title_taxonomy', '[term_type] - [term_name] - [pagination_paged] - [site_name]- [site_desc]'), 'default' => '[term_type] - [term_name] - [pagination_paged] - [site_name] - [site_desc]', 'label' => __('<code>TAXONOMY</code>', kopa_get_domain()), 'classes' => array('kopa_sub_field_control'), 'wrap_begin' => '<div class="kopa_sub_field_wrap">', 'wrap_end' => '</div>', 'help' => __('Category or Tag (taxonomy - display post lists with pagination)', kopa_get_domain())), array('type' => 'text', 'id' => 'seo_title_page', 'name' => 'seo_title_page', 'value' => KopaOptions::get_option('seo_title_page', '[page_name] - [site_name] - [site_desc]'), 'default' => '[page_name] - [site_name] - [site_desc]', 'label' => __('<code>PAGE</code>', kopa_get_domain()), 'classes' => array('kopa_sub_field_control'), 'wrap_begin' => '<div class="kopa_sub_field_wrap">', 'wrap_end' => '</div>', 'help' => __('Static Page', kopa_get_domain())), array('type' => 'text', 'id' => 'seo_title_post', 'name' => 'seo_title_post', 'value' => KopaOptions::get_option('seo_title_post', '[post_name] - Created by [post_author_name] - In category: [post_cats] - Tagged with: [post_tags] - [site_name] - [site_desc]'), 'default' => '[post_name] - Created by [post_author_name] - In category: [post_cats] - Tagged with: [post_tags] - [site_name] - [site_desc]', 'label' => __('<code>POST</code>', kopa_get_domain()), 'classes' => array('kopa_sub_field_control'), 'wrap_begin' => '<div class="kopa_sub_field_wrap">', 'wrap_end' => '</div>', 'help' => __('Single Post (article)', kopa_get_domain())), array('type' => 'text', 'id' => 'seo_title_author', 'name' => 'seo_title_author', 'value' => KopaOptions::get_option('seo_title_author', 'Posts created by [author_name] - [site_name] - [site_desc]'), 'default' => 'Posts created by [author_name] - [site_name] - [site_desc]', 'label' => __('<code>AUTHOR</code>', kopa_get_domain()), 'classes' => array('kopa_sub_field_control'), 'wrap_begin' => '<div class="kopa_sub_field_wrap">', 'wrap_end' => '</div>', 'help' => __('Author Page (display all posts created by an author)', kopa_get_domain())), array('type' => 'text', 'id' => 'seo_title_search', 'name' => 'seo_title_search', 'value' => KopaOptions::get_option('seo_title_search', 'Search pages: You searched for [search_phrase] return [search_result_count] results - [site_name] - [site_desc]'), 'default' => 'Search pages: You searched for [search_phrase] return [search_result_count] results - [site_name] - [site_desc]', 'label' => __('<code>SEARCH</code>', kopa_get_domain()), 'classes' => array('kopa_sub_field_control'), 'wrap_begin' => '<div class="kopa_sub_field_wrap">', 'wrap_end' => '</div>', 'help' => __('Search Page', kopa_get_domain())), array('type' => 'text', 'id' => 'seo_title_404', 'name' => 'seo_title_404', 'value' => KopaOptions::get_option('seo_title_404', 'Oops! 404 Page not found - [site_name] - [site_desc]'), 'default' => 'Oops! 404 Page not found - [site_name] - [site_desc]', 'label' => __('<code>404</code>', kopa_get_domain()), 'classes' => array('kopa_sub_field_control'), 'wrap_begin' => '<div class="kopa_sub_field_wrap">', 'wrap_end' => '</div>', 'help' => __('Page not found', kopa_get_domain())))); $groups['seo']['fields'][] = array('type' => 'textarea', 'id' => 'seo_keywords', 'name' => 'seo_keywords', 'label' => __('Keywords', kopa_get_domain()), 'help' => __('Enter your website keyword(s), separated by comma.<br/>This is global keywords, for each post, page, category, tag,.. you can manual append other keyword.', kopa_get_domain()), 'classes' => array('linedtextarea'), 'attributes' => array('rows' => 4), 'default' => ''); $groups['seo']['fields'][] = array('type' => 'textarea', 'id' => 'seo_descriptions', 'name' => 'seo_descriptions', 'label' => __('Description', kopa_get_domain()), 'help' => __('Enter your website description.<br/>This is global description, It will be replace by manual description from post, page, category, tag,..', kopa_get_domain()), 'classes' => array('linedtextarea'), 'attributes' => array('rows' => 4), 'default' => ''); $groups['seo']['fields'][] = array('type' => 'media', 'id' => 'seo_facebook_og_image', 'name' => 'seo_facebook_og_image', 'label' => __('Facebook Open Graph Image', kopa_get_domain()), 'help' => '<meta property="og:image" content="<code>YOUR IMAGE URL</code>">.' . __('<br/>It\'s default value for "og:image."', kopa_get_domain()), 'default' => ''); $groups['seo']['fields'][] = array('type' => 'text', 'id' => 'seo_facebook_og_type', 'name' => 'seo_facebook_og_type', 'label' => __('Facebook Open Graph Type', kopa_get_domain()), 'help' => '<meta property="og:type" content="<code>website</code>">.' . __('<br/>Enter your custom object type OR set default value is "website"."', kopa_get_domain()), 'default' => 'website'); $groups['seo']['fields'][] = array('type' => 'text', 'id' => 'seo_facebook_page_id', 'name' => 'seo_facebook_page_id', 'label' => __('Facebook Page ID', kopa_get_domain()), 'help' => '<meta property="fb:page_id" content="<code>1234567890</code>">', 'default' => ''); $groups['seo']['fields'][] = array('type' => 'text', 'id' => 'seo_facebook_app_id', 'name' => 'seo_facebook_app_id', 'label' => __('Facebook App ID', kopa_get_domain()), 'help' => '<meta property="fb:app_id" content="<code>1234567890</code>">', 'default' => ''); $groups['seo']['fields'][] = array('type' => 'text', 'id' => 'seo_facebook_admins', 'name' => 'seo_facebook_admins', 'label' => __('Facebook Admins', kopa_get_domain()), 'help' => '<meta property="fb:admins" content="<code>123,456,789</code>">', 'default' => ''); $groups['seo']['fields'][] = array('type' => 'text', 'id' => 'seo_google_profile_url', 'name' => 'seo_google_profile_url', 'label' => __('Google profile', kopa_get_domain()), 'help' => '<link rel="author" href="<code>https://plus.google.com/1234567890</code>"><br/>' . sprintf(__('<a href="%s" target="_blank">Link to your Google+ profile using rel="author"</a>.', kopa_get_domain()), 'https://plus.google.com/authorship'), 'default' => ''); $groups['seo']['fields'][] = array('type' => 'text', 'id' => 'seo_twitter_name', 'name' => 'seo_twitter_name', 'label' => __('Twitter cards', kopa_get_domain()), 'help' => __('Please enter your twitter name with format <code>@your_name</code>', kopa_get_domain()), 'default' => ''); /* * GOOGLE ANALYTICS * **************************** */ $groups['analytics'] = array('icon' => '', 'title' => __('Google analytics', kopa_get_domain()), 'fields' => array()); $groups['analytics']['fields'][] = array('type' => 'textarea', 'id' => 'tracking_code', 'name' => 'tracking_code', 'label' => NULL, 'help' => __('Enter <a href="http://www.google.com/analytics/" target="_blank">Google Analytics</a> code. This should be something like: <code><script type="text/javascript"> ... </script></code>', kopa_get_domain()), 'default' => '', 'classes' => array('linedtextarea'), 'attributes' => array('rows' => 10), 'control_begin' => '<div class="col-md-12">', 'control_end' => '</div>', 'help_begin' => '<div class="col-md-12">', 'help_end' => '</div>'); /* * WEBSITE VERIFICATION SERVICES * **************************** */ $groups['verification-services'] = array('icon' => '', 'title' => __('Website Verification Services', kopa_get_domain()), 'fields' => array()); $groups['verification-services']['fields'][] = array('type' => 'text', 'id' => 'google_verify_meta', 'name' => 'google_verify_meta', 'label' => __('Google Webmaster Tools', kopa_get_domain()), 'default' => '', 'help' => sprintf(__('Enter your meta key "content" value to verify your website with <a target="_blank" href="https://www.google.com/webmasters/tools/">Google Webmaster Tools</a>.<br/>Example:<br/>%s', kopa_get_domain()), '<meta name="google-site-verification" content="<code>dBw5CvburAxi537Rp9qi5uG2174Vb6JwHwIRwPSLIK8</code>">')); $groups['verification-services']['fields'][] = array('type' => 'text', 'id' => 'bing_verify_meta', 'name' => 'bing_verify_meta', 'label' => __('Bing Webmaster Center', kopa_get_domain()), 'default' => '', 'help' => sprintf(__('Enter your meta key "content" value to verify your website with <a target="_blank" href="http://www.bing.com/webmaster/">Bing Webmaster Center</a>.<br/>Example:<br/>%s', kopa_get_domain()), '<meta name="msvalidate.01" content="<code>12C1203B5086AECE94EB3A3D9830B2E</code>">')); $groups['verification-services']['fields'][] = array('type' => 'text', 'id' => 'pinterest_verify_meta', 'name' => 'pinterest_verify_meta', 'label' => __('Pinterest Site Verification', kopa_get_domain()), 'default' => '', 'help' => sprintf(__('Enter your meta key "content" value to verify your website with <a target="_blank" href="https://pinterest.com/website/verify/">Pinterest Site Verification</a>.<br/>Example:<br/>%s', kopa_get_domain()), '<meta name="p:domain_verify" content="<code>f100679e6048d45e4a0b0b92dce1efce</code>">')); $groups['verification-services']['fields'][] = array('type' => 'text', 'id' => 'yandex_verify_meta', 'name' => 'yandex_verify_meta', 'label' => __('Yandex Webmaster', kopa_get_domain()), 'default' => '', 'help' => sprintf(__('Enter your meta key "content" value to verify your website with <a target="_blank" href="https://webmaster.yandex.com/sites/">Yandex Webmaster</a>.<br/>Example:<br/>%s', kopa_get_domain()), '<meta name="yandex-verification" content="<code>44d68e1216009f40</code>">')); return apply_filters('kopa_options_seo', $groups); }
public function __construct($id_base = '', $name = '', $widget_options = array(), $control_options = array()) { $id_base = 'kopa_owl_slider'; $name = __('Kopa Slider Steel', kopa_get_domain()); $widget_options = array('classname' => 'kopa_owl_slider', 'description' => __("This is slider with owl carousel", kopa_get_domain())); $control_options = array('width' => '500', 'height' => 'auto'); parent::__construct($id_base, $name, $widget_options, $control_options); unset($this->groups['col-1']['fields']['posts_per_page']); unset($this->groups['col-1']['fields']['excerpt_character_limit']); unset($this->groups['col-1']['fields']['is_hide_title']); unset($this->groups['col-1']['fields']['is_hide_excerpt']); $this->groups['col-1']['fields']['title']['type'] = 'hidden'; $this->groups['col-1']['fields']['title']['label'] = ''; $this->groups['col-2']['fields']['transition_type'] = array('type' => 'select', 'id' => 'transition_type', 'name' => 'transition_type', 'default' => 'backSlide', 'classes' => array(), 'label' => __('Transition type', kopa_get_domain()), 'help' => NULL, 'options' => array('fade' => __('fade', kopa_get_domain()), 'fadeUp' => __('fadeUp', kopa_get_domain()), 'backSlide' => __('backSlide', kopa_get_domain()), 'goDown' => __('goDown', kopa_get_domain()))); }
public function __construct($id_base = '', $name = '', $widget_options = array(), $control_options = array()) { $id_base = 'kopa_advertisement'; $name = __('Kopa Advertisement', kopa_get_domain()); $widget_options = array('classname' => 'kopa_advertisement widget-adv', 'description' => __('Display banner image', kopa_get_domain())); $control_options = array('width' => 'auto', 'height' => 'auto'); parent::__construct($id_base, $name, $widget_options, $control_options); $col = array('size' => 12, 'fields' => array()); $col['fields']['title'] = array('type' => 'text', 'id' => 'title', 'name' => 'title', 'default' => '', 'classes' => array(), 'label' => __('Title', kopa_get_domain()), 'help' => NULL); $col['fields']['image'] = array('type' => 'media', 'id' => 'image', 'name' => 'image', 'default' => '', 'classes' => array(), 'label' => __('Upload Image', kopa_get_domain()), 'help' => NULL); $col['fields']['size'] = array('type' => 'select', 'id' => 'size', 'name' => 'size', 'default' => '000x000', 'classes' => array(), 'label' => NULl, 'help' => NULL, 'options' => array('000x000' => __('Select size of image', kopa_get_domain()), '120x240' => __('120 x 240', kopa_get_domain()), '120x600' => __('120 x 600', kopa_get_domain()), '125x125' => __('125 x 125', kopa_get_domain()), '160x600' => __('160 x 600', kopa_get_domain()), '180x150' => __('180 x 150', kopa_get_domain()), '200x200' => __('200 x 200', kopa_get_domain()), '234x60' => __('234 x 60', kopa_get_domain()), '250x250' => __('250 x 250', kopa_get_domain()), '300x250' => __('300 x 250', kopa_get_domain()), '336x280' => __('336 x 280', kopa_get_domain()), '468x60' => __('468 x 60', kopa_get_domain()), '728x90' => __('728 x 90', kopa_get_domain()))); $col['fields']['href'] = array('type' => 'url', 'id' => 'href', 'name' => 'href', 'default' => '', 'classes' => array(), 'label' => __('Link to', kopa_get_domain()), 'help' => NULL); $col['fields']['target'] = array('type' => 'checkbox', 'id' => 'target', 'name' => 'target', 'default' => 'false', 'classes' => array(), 'label' => __('Open link in new tab', kopa_get_domain()), 'help' => NULL, 'is_append_label_before_control' => false); $this->groups['col'] = $col; }
/** * * * @package Kopa * @subpackage Core * @author thethangtran <*****@*****.**> * @since 1.0.0 * */ function kopa_shortcode_term_type($atts, $content = null) { $term_type = ''; if (is_main_query() && is_tag() || is_category()) { $term = get_queried_object(); switch ($term->taxonomy) { case 'category': $term_type = __('Category', kopa_get_domain()); break; case 'post_tag': $term_type = __('Tag', kopa_get_domain()); break; } } return apply_filters('kopa_shortcode_term_type', $term_type); }
/** * * * @package Kopa * @subpackage Core * @author thethangtran <*****@*****.**> * @since 1.0.0 * */ protected function get_control() { $this->classes[] = 'kopa-ui-gallery'; $this->set_attribute('autocomplete', 'off'); $this->set_attribute('readonly', 'readonly'); $html = '<div class="kopa-ui-gallery-wrap">'; $html .= '<div class="row row_space15 clearfix">'; $html .= '<div class="col-xs-6 col-sm-10 col-md-10">'; $html .= sprintf('<input type="text" id="%s" name="%s" class="%s" value="%s" %s/>', $this->id, $this->name, implode(' ', $this->classes), $this->value, $this->unserialize_attributes()); $html .= '</div>'; $html .= '<div class="col-xs-6 col-sm-2 col-md-2">'; $html .= sprintf('<span class="btn btn-primary btn-ssm width_full" onclick="KopaUI.config_gallery(event, jQuery(this));">%s</span>', __('Config gallery', kopa_get_domain())); $html .= '</div>'; $html .= '</div>'; return $html; }
function kopa_widget_posttype_build_query($query_args = array()) { $default_query_args = array('post_type' => 'post', 'posts_per_page' => -1, 'post__not_in' => array(), 'ignore_sticky_posts' => 1, 'categories' => array(), 'tags' => array(), 'relation' => 'OR', 'orderby' => '', 'cat_name' => 'category', 'tag_name' => 'post_tag', 'offset' => 0); $query_args = wp_parse_args($query_args, $default_query_args); $args = array('post_type' => $query_args['post_type'], 'posts_per_page' => $query_args['posts_per_page'], 'post__not_in' => $query_args['post__not_in'], 'ignore_sticky_posts' => $query_args['ignore_sticky_posts'], 'offset' => $query_args['offset']); $tax_query = array(); if ($query_args['categories']) { $tax_query[] = array('taxonomy' => $query_args['cat_name'], 'field' => 'id', 'terms' => $query_args['categories']); } if ($query_args['tags']) { $tax_query[] = array('taxonomy' => $query_args['tag_name'], 'field' => 'id', 'terms' => $query_args['tags']); } if ($query_args['relation'] && count($tax_query) == 2) { $tax_query['relation'] = $query_args['relation']; } if ($tax_query) { $args['tax_query'] = $tax_query; } switch ($query_args['orderby']) { case 'popular': $args['meta_key'] = 'kopa_' . kopa_get_domain() . '_total_view'; $args['orderby'] = 'meta_value_num'; break; case 'most_comment': $args['orderby'] = 'comment_count'; break; case 'random': $args['orderby'] = 'rand'; break; default: $args['orderby'] = 'date'; break; } if (isset($query_args['date_query']) && $query_args['date_query']) { global $wp_version; $timestamp = $query_args['date_query']; if (version_compare($wp_version, '3.7.0', '>=')) { if (isset($timestamp) && !empty($timestamp)) { $y = date('Y', strtotime($timestamp)); $m = date('m', strtotime($timestamp)); $d = date('d', strtotime($timestamp)); $args['date_query'] = array(array('after' => array('year' => (int) $y, 'month' => (int) $m, 'day' => (int) $d))); } } } return new WP_Query($args); }
public function __construct($id_base = '', $name = '', $widget_options = array(), $control_options = array()) { $id_base = 'kopa_recent_comments'; $name = __('Kopa Recent Comments', kopa_get_domain()); $widget_options = array('classname' => 'kopa_recent_comments widget-recent-comment', 'description' => __("Your site's most recent Posts", kopa_get_domain())); $control_options = array('width' => 'auto', 'height' => 'auto'); parent::__construct($id_base, $name, $widget_options, $control_options); $col = array('size' => 12, 'fields' => array()); $col['fields']['title'] = array('type' => 'text', 'id' => 'title', 'name' => 'title', 'default' => '', 'classes' => array(), 'label' => __('Title', kopa_get_domain()), 'help' => NULL); $col['fields']['limit'] = array('type' => 'number', 'id' => 'limit', 'name' => 'limit', 'default' => 4, 'classes' => array(), 'label' => __('Number of comments', kopa_get_domain())); $col['fields']['comment_character_limit'] = array('type' => 'number', 'id' => 'comment_character_limit', 'name' => 'comment_character_limit', 'default' => 60, 'classes' => array(), 'label' => __('Comment character limit', kopa_get_domain()), 'help' => NULL); $col['fields']['is_hide_author'] = array('type' => 'checkbox', 'id' => 'is_hide_author', 'name' => 'is_hide_author', 'default' => 'false', 'classes' => array(), 'label' => __('Is hide author name', kopa_get_domain()), 'help' => NULL, 'is_append_label_before_control' => false); $col['fields']['is_hide_gravatar'] = array('type' => 'checkbox', 'id' => 'is_hide_gravatar', 'name' => 'is_hide_gravatar', 'default' => 'false', 'classes' => array(), 'label' => __('Is hide gravatar', kopa_get_domain()), 'help' => NULL, 'is_append_label_before_control' => false); $col['fields']['is_hide_created_date'] = array('type' => 'checkbox', 'id' => 'is_hide_created_date', 'name' => 'is_hide_created_date', 'default' => 'false', 'classes' => array(), 'label' => __('Is hide created date', kopa_get_domain()), 'help' => NULL, 'is_append_label_before_control' => false); $col['fields']['is_hide_comment'] = array('type' => 'checkbox', 'id' => 'is_hide_comment', 'name' => 'is_hide_comment', 'default' => 'false', 'classes' => array(), 'label' => __('Is hide comment content', kopa_get_domain()), 'help' => NULL, 'is_append_label_before_control' => false); $this->groups['col'] = $col; }
public function update_fields($instance) { $number_of_slides = isset($instance['number_of_slides']) ? (int) $instance['number_of_slides'] : 2; if ($number_of_slides > 0) { for ($i = 0; $i < $number_of_slides; $i++) { $slide_id = "slide_{$i}"; for ($j = 0; $j < 5; $j++) { $label = 0 == $j ? sprintf(__("Slide no.%s", kopa_get_domain()), $i + 1) : NULL; $placeholder = sprintf(__('Line %s', kopa_get_domain()), $j + 1); if (4 == $j) { $placeholder = __('URL', kopa_get_domain()); } $line_id = "{$slide_id}_line_{$j}"; $this->groups['col']['fields'][$line_id] = array('type' => 'text', 'id' => $line_id, 'name' => $line_id, 'default' => '', 'label' => $label, 'classes' => array(), 'help' => NULL, 'attributes' => array('placeholder' => $placeholder)); } } } }
public function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); echo $before_widget; if (!empty($title)) { echo $before_title . $title . $after_title; } echo '<div class="textwidget">'; echo empty($instance['description']) ? '' : "<p class='first'>{$instance['description']}</p>"; $address = KopaOptions::get_option('contact_address', false); echo !$address ? '' : '<p><span>' . __('Add:', kopa_get_domain()) . '</span> ' . $address . '</p>'; $fax = KopaOptions::get_option('contact_fax', false); echo !$fax ? '' : '<p><span>' . __('Fax:', kopa_get_domain()) . '</span> ' . $fax . '</p>'; $mobile = KopaOptions::get_option('contact_phone', false); echo !$mobile ? '' : '<p><span>' . __('Mobile:', kopa_get_domain()) . '</span> ' . $mobile . '</p>'; $email = KopaOptions::get_option('contact_email', false); echo !$email ? '' : '<p><span>' . __('Email:', kopa_get_domain()) . '</span> ' . $email . '</p>'; echo '</div>'; echo $after_widget; }
/** * * @package Kopa * @subpackage Core * @author thethangtran <*****@*****.**> * @since 1.0.0 * */ function kopa_options_shortcode() { /* * YOUTUBE SHORTCODE * **************************** */ $groups['youtube'] = array('icon' => '', 'title' => __('Youtube (shortcode)', kopa_get_domain()), 'fields' => array()); $groups['youtube']['fields'][] = array('type' => 'radio-truefalse', 'id' => 'is_youtube_showinfo', 'name' => 'is_youtube_showinfo', 'label' => __('Video information', kopa_get_domain()), 'default' => 'true', 'true' => __('Show', kopa_get_domain()), 'false' => __('Hide', kopa_get_domain()), 'help' => __('If you set the parameter value to <code>Hide</code>, then the player will not display information like the video title and uploader before the video starts playing.', kopa_get_domain())); $groups['youtube']['fields'][] = array('type' => 'select', 'id' => 'youtube_theme', 'name' => 'youtube_theme', 'label' => __('Theme', kopa_get_domain()), 'help' => NULL, 'default' => 'light', 'options' => array('dark ' => __('The Dark', kopa_get_domain()), 'light' => __('The Light', kopa_get_domain()))); $groups['youtube']['fields'][] = array('type' => 'select', 'id' => 'youtube_controls', 'name' => 'youtube_controls', 'label' => __('Coltrols', kopa_get_domain()), 'help' => NULL, 'default' => 2, 'options' => array(0 => __('Player controls DO NOT display in the player.', kopa_get_domain()), 1 => __('Player controls display in the player', kopa_get_domain()), 2 => __('Player controls ONLY display in the player (after the user initiates the video playback)', kopa_get_domain()))); $groups['youtube']['fields'][] = array('type' => 'radio-truefalse', 'id' => 'is_youtube_hd_enable', 'name' => 'is_youtube_hd_enable', 'label' => __('HD playback by default', kopa_get_domain()), 'default' => 'false', 'true' => __('Enable', kopa_get_domain()), 'false' => __('Disable', kopa_get_domain()), 'help' => __('This has no effect on the Chromeless Player.<br/> This also has no effect if an HD version of the video is not available.', kopa_get_domain())); $groups['youtube']['fields'][] = array('type' => 'radio-truefalse', 'id' => 'is_youtube_rel_enable', 'name' => 'is_youtube_rel_enable', 'label' => __('Related videos', kopa_get_domain()), 'default' => 'true', 'true' => __('Show', kopa_get_domain()), 'false' => __('Hide', kopa_get_domain()), 'help' => __('This option indicates whether the player should show related videos when playback of the initial video ends', kopa_get_domain())); /* * VIMEO SHORTCODE * **************************** */ $groups['vimeo'] = array('icon' => '', 'title' => __('Vimeo (shortcode)', kopa_get_domain()), 'fields' => array()); $groups['vimeo']['fields'][] = array('type' => 'color', 'id' => 'vimeo_color', 'name' => 'vimeo_color', 'label' => __('Color', kopa_get_domain()), 'help' => 'Specify the color of the video controls', 'default' => '#00adef'); $groups['vimeo']['fields'][] = array('type' => 'radio-truefalse', 'id' => 'is_show_vimeo_title', 'name' => 'is_show_vimeo_title', 'label' => __('Title', kopa_get_domain()), 'default' => 'false', 'true' => __('Show', kopa_get_domain()), 'false' => __('Hide', kopa_get_domain()), 'help' => __('Show the title on the video', kopa_get_domain())); $groups['vimeo']['fields'][] = array('type' => 'radio-truefalse', 'id' => 'is_show_vimeo_byline', 'name' => 'is_show_vimeo_byline', 'label' => __('Byline', kopa_get_domain()), 'default' => 'false', 'true' => __('Show', kopa_get_domain()), 'false' => __('Hide', kopa_get_domain()), 'help' => __("Show the user's byline on the video", kopa_get_domain())); $groups['vimeo']['fields'][] = array('type' => 'radio-truefalse', 'id' => 'is_show_vimeo_portrait', 'name' => 'is_show_vimeo_portrait', 'label' => __('Portrait', kopa_get_domain()), 'default' => 'true', 'true' => __('Show', kopa_get_domain()), 'false' => __('Hide', kopa_get_domain()), 'help' => __("Show the user's portrait on the video", kopa_get_domain())); return apply_filters('kopa_options_shortcode', $groups); }
function kopa_meta_box_slider_background_image_cb($post) { $dir = get_template_directory_uri() . '/library/js'; wp_enqueue_script('jquery'); wp_enqueue_script('kopa-uploader', "{$dir}/uploader.js", array('jquery'), NULL, TRUE); $slider_background_image = get_post_meta($post->ID, 'slider_background_image', true); wp_nonce_field('post_slider_background_image_meta_box_nonce', 'post_slider_background_image_meta_box_nonce'); ?> <div class="kopa-content-box"> <div class="kopa-box-head"> <i class="icon-hand-right"></i> <span class="kopa-section-title">Upload Background Image</span> </div> <div class="kopa-box-body"> <div class="kopa-element-box kopa-theme-options"> <span class="kopa-component-title"><?php _e('Slider Background Image', kopa_get_domain()); ?> </span> <p class="kopa-desc"><?php _e('Upload your own slider background image.', kopa_get_domain()); ?> </p> <div class="clearfix"> <input class="left" type="text" value="<?php echo esc_attr($slider_background_image); ?> " id="slider_background_image" name="slider_background_image"> <button class="left btn btn-success upload_image_button" alt="slider_background_image"><i class="icon-circle-arrow-up"></i><?php _e('Upload', kopa_get_domain()); ?> </button> </div> </div><!--kopa-element-box--> </div><!-- kopa-box-body --> </div> <!-- kopa-content-box --> <?php }
/** * * * @package Kopa * @subpackage Core * @author thethangtran <*****@*****.**> * @since 1.0.0 * */ public function __construct($args = array()) { parent::__construct($args); $this->post_type = isset($args['post_type']) ? $args['post_type'] : array('post'); $this->posts_per_page = isset($args['posts_per_page']) ? $args['posts_per_page'] : -1; $this->args_extra = isset($args['args_extra']) ? $args['args_extra'] : array(); $this->options = array(); $this->options[0] = __('-- Select --', kopa_get_domain()); $args = array('post_type' => $this->post_type, 'posts_per_page' => $this->posts_per_page, 'post_status' => array('publish'), 'ignore_sticky_posts' => true); if (!empty($this->args_extra)) { $args = array_merge($args, $this->args_extra); } $posts = new WP_Query($args); if ($posts->have_posts()) { while ($posts->have_posts()) { $posts->the_post(); $post_id = get_the_ID(); $post_title = get_the_title(); $this->options[$post_id] = $post_title; } } wp_reset_postdata(); }