/** * * * @package Kopa * @subpackage Core * @author thethangtran <*****@*****.**> * @since 1.0.0 * */ function kopa_shortcode_contact_form($atts, $content = null) { global $kopa; $content = ''; #Get config information $mail = KopaOptions::get_option('contact_email'); $phone = KopaOptions::get_option('contact_phone'); $fax = KopaOptions::get_option('contact_fax'); $address = KopaOptions::get_option('contact_address'); $google_map = KopaOptions::get_option('contact_map'); $info_caption = KopaOptions::get_option('contact_info_caption'); $info_description = KopaOptions::get_option('contact_info_description'); $form_caption = KopaOptions::get_option('contact_form_caption'); $form_description = KopaOptions::get_option('contact_form_description'); $recaptcha_skin = KopaOptions::get_option('recaptcha_skin', 'off'); $publickey = KopaOptions::get_option('recaptcha_public_key'); $privatekey = KopaOptions::get_option('recaptcha_private_key'); if ($google_map) { $maps_arr = explode(',', $google_map); if (2 == count($maps_arr)) { $content .= sprintf("<div id='kp-map' class='kp-map' data-latitude='%s' data-longitude='%s'></div>", $maps_arr[0], $maps_arr[1]); } } $content .= '<div class="contact-info">'; $content .= '<div class="container">'; $content .= $info_caption ? sprintf('<h3 class="contact-title">%s</h3>', $info_caption) : ''; $content .= $info_description ? sprintf('<p>%s</p>', $info_description) : ''; if ($mail || $phone || $working_time || $address) { $number_of_cols = 0; $number_of_cols = !empty($mail) ? $number_of_cols + 1 : $number_of_cols; $number_of_cols = !empty($phone) ? $number_of_cols + 1 : $number_of_cols; $number_of_cols = !empty($fax) ? $number_of_cols + 1 : $number_of_cols; $number_of_cols = !empty($address) ? $number_of_cols + 1 : $number_of_cols; $col_classes = array(); switch ($number_of_cols) { case '1': $col_classes = array('col-xs-12'); break; case '2': $col_classes = array('col-md-6', 'col-sm-6', 'col-xs-6'); break; case '3': $col_classes = array('col-md-4', 'col-sm-6', 'col-xs-6'); break; default: $col_classes = array('col-md-3', 'col-sm-6', 'col-xs-6'); break; } $content .= '<div class="row">'; if (!empty($address)) { $content .= sprintf('<div class="%s">', implode(' ', $col_classes)); $content .= '<div class="item">'; $content .= sprintf('<span>%s</span>', KopaIcon::getIcon('fa fa-map-marker')); $content .= sprintf('<h4>%s</h4>', __('Address', kopa_get_domain())); $content .= sprintf('<p>%s</p>', $address); $content .= '</div>'; $content .= '</div>'; } if (!empty($phone)) { $content .= sprintf('<div class="%s">', implode(' ', $col_classes)); $content .= '<div class="item">'; $content .= sprintf('<span>%s</span>', KopaIcon::getIcon('fa fa-phone')); $content .= sprintf('<h4>%s</h4>', __('Phone number', kopa_get_domain())); $content .= sprintf('<p>%s</p>', $phone); $content .= '</div>'; $content .= '</div>'; } if (!empty($fax)) { $content .= sprintf('<div class="%s">', implode(' ', $col_classes)); $content .= '<div class="item">'; $content .= sprintf('<span>%s</span>', KopaIcon::getIcon('fa fa-print')); $content .= sprintf('<h4>%s</h4>', __('Fax number', kopa_get_domain())); $content .= sprintf('<p>%s</p>', $fax); $content .= '</div>'; $content .= '</div>'; } if (!empty($mail)) { $content .= sprintf('<div class="%s">', implode(' ', $col_classes)); $content .= '<div class="item">'; $content .= sprintf('<span>%s</span>', KopaIcon::getIcon('fa fa-envelope-o')); $content .= sprintf('<h4>%s</h4>', __('Email', kopa_get_domain())); $content .= sprintf('<p>%s</p>', $mail); $content .= '</div>'; $content .= '</div>'; } $content .= '</div>'; } $content .= '</div>'; $content .= '</div>'; $content .= '<div class="form-contact">'; $content .= '<div class="container">'; $content .= $form_caption ? sprintf('<h3 class="contact-title">%s</h3>', $form_caption) : ''; $content .= $form_description ? sprintf('<p>%s</p>', $form_description) : ''; $content .= '<form id="contact-form" class="contact-form clearfix" action="' . admin_url('admin-ajax.php') . '" method="post" autocomplete="off">'; $content .= '<div class="row">'; $content .= '<div class="col-md-6 col-sm-6 col-sx-12">'; $content .= '<div class="form-group">'; $content .= sprintf('<input class="form-control" type="text" id="contact_name" name="contact_name" placeholder="%s">', __('Name', kopa_get_domain())); $content .= '</div>'; $content .= '</div>'; $content .= '<div class="col-md-6 col-sm-6 col-sx-12">'; $content .= '<div class="form-group">'; $content .= sprintf('<input class="form-control" type="text" id="contact_email" name="contact_email" placeholder="%s">', __('Email', kopa_get_domain())); $content .= '</div>'; $content .= '</div>'; $content .= '</div>'; $content .= '<div class="form-group">'; $content .= sprintf('<textarea class="form-control" id="contact_message" name="contact_message" placeholder="%s"></textarea>', __('Your message', kopa_get_domain())); $content .= '</div>'; if ('off' != $recaptcha_skin && $publickey && $privatekey) { $content .= '<div class="recaptcha-block clearfix">'; $content .= recaptcha_get_html($publickey); $content .= '</div>'; } #SUBMIT $content .= '<div class="contact-button">'; $content .= '<input type="hidden" name="action" value="kopa_send_contact">'; $content .= wp_nonce_field('kopa_send_contact', 'ajax_nonce', true, false); $content .= wp_nonce_field('kopa_check_recaptcha', 'ajax_nonce_recaptcha', false, false); $content .= '<input type="submit" name="submit-contact" id="submit-contact" class="btn btn-block style-5" value="' . __('Send', kopa_get_domain()) . '">'; $content .= '</div>'; $content .= '</form>'; $content .= '<div id="contact_response"></div>'; $content .= '</div>'; $content .= '</div>'; return $content; }
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; } $query = $this->build_query($instance); $posts = new WP_Query($query); if ($posts->have_posts()) { global $post; $metadata = array(); $metadata['date'] = 'true' != $instance['is_hide_created_date'] ? true : false; $metadata['comments'] = 'true' != $instance['is_hide_comments'] ? true : false; $metadata['views'] = 'true' != $instance['is_hide_views'] ? true : false; $metadata['likes'] = 'true' != $instance['is_hide_likes'] ? true : false; ?> <div class="widget-content"> <div class="owl-carousel"> <?php while ($posts->have_posts()) { $posts->the_post(); $post_id = get_the_ID(); $post_title = get_the_title(); $post_url = get_permalink(); if (has_post_thumbnail()) { $image_croped = KopaImage::get_post_image_src($post_id, 'size_05'); ?> <div <?php post_class('item'); ?> > <a href="<?php echo $post_url; ?> "><img src="<?php echo $image_croped; ?> " alt="<?php echo $post_title; ?> "></a> <div class="kp-caption"> <?php if ('true' != $instance['is_hide_title']) { ?> <h3 class="post-title"><a href="<?php echo $post_url; ?> "><?php echo $post_title; ?> </a></h3> <?php } ?> </div> <?php if ($metadata['date'] || $metadata['comments'] || $metadata['views'] || $metadata['likes']) { ?> <footer> <ul class="kp-meta-post list-inline"> <?php $is_metadata_first = true; foreach ($metadata as $key => $val) { if ($val) { $class = $is_metadata_first ? 'metadata-first' : ''; $is_metadata_first = false; switch ($key) { case 'date': printf('<li class="%s">%s<span>%s</span></li>', $class, KopaIcon::getIconDatetime(), get_the_date()); break; case 'comments': ?> <li class="<?php echo $class; ?> "><?php echo KopaIcon::getIconComment(); ?> <span><?php comments_popup_link(__('No Comment', kopa_get_domain()), __('1 Comment', kopa_get_domain()), __('% Comments', kopa_get_domain()), '', __('0 Comment', kopa_get_domain())); ?> </span></li> <?php break; case 'views': printf('<li class="%s">%s<span>%s</span></li>', $class, KopaIcon::getIconView(), KopaUtil::get_views($post_id, true)); break; case 'likes': printf('<li class="%s">%s</li>', $class, KopaUtil::kopa_get_like_button($post_id, true)); break; } } } ?> </ul> </footer> <?php } ?> </div> <?php } } ?> </div> </div> <?php } else { _e('Posts not found. Pleae config this widget again!', kopa_get_domain()); } wp_reset_postdata(); echo $after_widget; }
<div class="kopa-element-box kopa-theme-options"> <span class="kopa-component-title"><?php _e('Footer logo', kopa_get_domain()); ?> </span> <p class="kopa-desc"><?php _e('Upload your own logo.', kopa_get_domain()); ?> </p> <div class="clearfix"> <input class="left" type="text" value="<?php echo get_option('kopa_theme_options_logo_url'); ?> " id="kopa_theme_options_logo_url" name="kopa_theme_options_logo_url"> <button class="left btn btn-success upload_image_button" alt="kopa_theme_options_logo_url"><?php echo KopaIcon::getIcon('arrow-circle-up'); _e('Upload', kopa_get_domain()); ?> </button> </div> </div><!--kopa-element-box--> <div class="kopa-element-box kopa-theme-options"> <span class="kopa-component-title"><?php _e('Custom Left Footer', kopa_get_domain()); ?> </span> <p class="kopa-desc"><?php _e('Enter the content you want to display in your left footer (e.g. copyright text).', kopa_get_domain()); ?> </p> <textarea class="" rows="6" id="kopa_setting_copyrights" name="kopa_theme_options_copyright"><?php
<div id="tab-custom-css" class="kopa-content-box tab-content tab-content-1"> <div class="kopa-box-head"> <?php echo KopaIcon::getIcon('hand-right'); ?> <span class="kopa-section-title"><?php _e('Custom CSS', kopa_get_domain()); ?> </span> </div><!--kopa-box-head--> <div class="kopa-box-body"> <div class="kopa-element-box kopa-theme-options"> <p class="kopa-desc"><?php _e('Enter the your custom CSS code', kopa_get_domain()); ?> </p> <textarea class="" rows="10" id="kopa_custom_css" name="kopa_theme_options[kopa_theme_options_custom_css]"><?php echo esc_html(esc_textarea(kopa_get_option('kopa_theme_options_custom_css'))); ?> </textarea> </div><!--kopa-element-box--> </div><!--tab-theme-skin--> </div><!--tab-container-->
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; } $query = $this->build_query($instance); $posts = new WP_Query($query); if ($posts->have_posts()) { $metadata = array(); $metadata['date'] = 'true' != $instance['is_hide_created_date'] ? true : false; $metadata['comments'] = 'true' != $instance['is_hide_comments'] ? true : false; global $post; ?> <div class="widget-content"> <ul class="list-unstyled"> <?php $is_first = true; while ($posts->have_posts()) { $posts->the_post(); $post_id = get_the_ID(); $post_title = get_the_title(); $post_url = get_permalink(); if ($is_first) { $is_first = false; ?> <li <?php post_class('style-1'); ?> > <div class="item clearfix"> <?php if (has_post_thumbnail()) { $image_croped = KopaImage::get_post_image_src($post_id, 'size_02'); ?> <a href="<?php echo $post_url; ?> " class="pull-left"> <img src="<?php echo $image_croped; ?> " alt=""> </a> <?php } ?> <div class="item-right"> <?php if ('true' != $instance['is_hide_title']) { ?> <h4 class="post-title"><a href="<?php echo $post_url; ?> "><?php echo $post_title; ?> </a></h4> <?php } ?> <?php if ($metadata['date'] || $metadata['comments']) { ?> <ul class="kp-meta-post list-inline"> <?php $is_metadata_first = true; foreach ($metadata as $key => $val) { if ($val) { $class = $is_metadata_first ? 'metadata-first' : ''; $is_metadata_first = false; switch ($key) { case 'date': printf('<li class="%s">%s<span>%s</span></li>', $class, KopaIcon::getIconDatetime(), get_the_date()); break; case 'comments': ?> <li class="<?php echo $class; ?> "><?php echo KopaIcon::getIconComment(); ?> <span><?php comments_popup_link(__('No Comment', kopa_get_domain()), __('1 Comment', kopa_get_domain()), __('% Comments', kopa_get_domain()), '', __('0 Comment', kopa_get_domain())); ?> </span></li> <?php break; } } } ?> </ul> <?php } ?> <?php if ('true' != $instance['is_hide_excerpt']) { if ((int) $instance['excerpt_character_limit'] > 0) { $excerpt = KopaUtil::substr($post->post_content, (int) $instance['excerpt_character_limit']); echo $excerpt ? sprintf('<p>%s</p>', $excerpt) : ''; } else { the_excerpt(); } } ?> <?php if ('true' != $instance['is_hide_readmore']) { ?> <a class="read-more" href="<?php echo $post_url; ?> "><?php _e('Read more', kopa_get_domain()); ?> </a> <?php } ?> </div> </div> </li> <?php } else { ?> <li> <div class="item clearfix"> <?php if (has_post_thumbnail()) { $image_croped = KopaImage::get_post_image_src($post_id, 'size_00'); ?> <a href="<?php echo $post_url; ?> " class="pull-left"> <img src="<?php echo $image_croped; ?> " alt=""> </a> <?php } ?> <div class="item-right"> <?php if ('true' != $instance['is_hide_title']) { ?> <h4 class="post-title"><a href="<?php echo $post_url; ?> "><?php echo $post_title; ?> </a></h4> <?php } ?> <?php if ($metadata['date'] || $metadata['comments']) { ?> <ul class="kp-meta-post list-inline"> <?php $is_metadata_first = true; foreach ($metadata as $key => $val) { if ($val) { $class = $is_metadata_first ? 'metadata-first' : ''; $is_metadata_first = false; switch ($key) { case 'date': printf('<li class="%s">%s<span>%s</span></li>', $class, KopaIcon::getIconDatetime(), get_the_date()); break; break; } } } ?> </ul> <?php } ?> </div> </div> </li> <?php } } ?> </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 */ public static function kopa_get_like_button($post_id, $include_text = false) { $class = ''; if (self::is_liked($post_id)) { $class = 'kopa-button-likes-disable'; } else { $class = 'kopa-button-likes-enable'; } $onclick = sprintf('onclick="KopaFrontend.click_likes_button(event, jQuery(this), %s, \'%s\')"', $post_id, $include_text); $out = sprintf('<span class="%s" %s>%s<span>%s</span></span>', $class, $onclick, KopaIcon::getIconLike(), KopaUtil::get_likes($post_id, $include_text)); return apply_filters('kopa_get_like_button', $out, $post_id); }
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; } $query = $this->build_query($instance); $posts = new WP_Query($query); if ($posts->have_posts()) { global $post; $max = (int) $instance['posts_per_page']; $limit_carousel = $max >= 3 ? $posts->post_count - 2 : -1; $loop_index = 0; $metadata = array(); $metadata['date'] = 'true' != $instance['is_hide_created_date'] ? true : false; $metadata['comments'] = 'true' != $instance['is_hide_comments'] ? true : false; $metadata['views'] = 'true' != $instance['is_hide_views'] ? true : false; $metadata['likes'] = 'true' != $instance['is_hide_likes'] ? true : false; ?> <div class="widget-content clearfix"> <div class="owl-carousel pull-left"> <?php while ($posts->have_posts()) { $posts->the_post(); $post_id = get_the_ID(); $post_title = get_the_title(); $post_url = get_permalink(); if (-1 != $limit_carousel && $limit_carousel == $loop_index) { break; } else { $loop_index++; } ?> <div <?php post_class('item'); ?> > <?php if (has_post_thumbnail()) { $image_croped = KopaImage::get_post_image_src($post_id, 'size_04'); ?> <a href="<?php echo $post_url; ?> "><img src="<?php echo $image_croped; ?> " alt="<?php echo $post_title; ?> "/></a> <?php } ?> <?php if ('true' != $instance['is_hide_title'] || 'true' != $instance['is_hide_excerpt']) { ?> <div class="kp-caption"> <?php if ('true' != $instance['is_hide_title']) { ?> <?php $h4_class = 'true' != $instance['is_hide_excerpt'] ? '' : 'hide_excerpt'; ?> <h4 class="post-title <?php echo $h4_class; ?> "><a href="<?php echo $post_url; ?> "><?php echo $post_title; ?> </a></h4> <?php } ?> <?php if ('true' != $instance['is_hide_excerpt']) { if ((int) $instance['excerpt_character_limit'] > 0) { $excerpt = KopaUtil::substr($post->post_content, (int) $instance['excerpt_character_limit']); echo $excerpt ? sprintf('<p>%s</p>', $excerpt) : ''; } else { the_excerpt(); } } ?> </div> <?php } ?> <?php if ($metadata['date'] || $metadata['comments'] || $metadata['views'] || $metadata['likes']) { ?> <footer> <ul class="kp-meta-post list-inline"> <?php $is_metadata_first = true; foreach ($metadata as $key => $val) { if ($val) { $class = $is_metadata_first ? 'metadata-first' : ''; $is_metadata_first = false; switch ($key) { case 'date': printf('<li class="%s">%s<span>%s</span></li>', $class, KopaIcon::getIconDatetime(), get_the_date()); break; case 'comments': ?> <li class="<?php echo $class; ?> "><?php echo KopaIcon::getIconComment(); ?> <span><?php comments_popup_link(__('No Comment', kopa_get_domain()), __('1 Comment', kopa_get_domain()), __('% Comments', kopa_get_domain()), '', __('0 Comment', kopa_get_domain())); ?> </span></li> <?php break; case 'views': printf('<li class="%s">%s<span>%s</span></li>', $class, KopaIcon::getIconView(), KopaUtil::get_views($post_id, true)); break; case 'likes': printf('<li class="%s">%s</li>', $class, KopaUtil::kopa_get_like_button($post_id, true)); break; } } } ?> </ul> </footer> <?php } ?> </div> <?php } wp_reset_postdata(); ?> </div> <?php if (-1 != $limit_carousel) { ?> <ul class="list-content pull-left list-unstyled"> <?php $sub_posts = new WP_Query($query); $sub_loop_index = 0; while ($sub_posts->have_posts()) { $sub_posts->the_post(); $post_id = get_the_ID(); $post_title = get_the_title(); $post_url = get_permalink(); if ($sub_loop_index >= $limit_carousel) { ?> <li> <?php if (has_post_thumbnail()) { $image_croped = KopaImage::get_post_image_src($post_id, 'size_02'); ?> <a href="<?php echo $post_url; ?> "><img src="<?php echo $image_croped; ?> " alt="<?php echo $post_title; ?> "/></a> <?php } ?> <?php if ('true' != $instance['is_hide_title']) { ?> <h4 class="post-title"><a href="<?php echo $post_url; ?> "><?php echo $post_title; ?> </a></h4> <?php } ?> <?php if ($metadata['date'] || $metadata['comments'] || $metadata['views'] || $metadata['likes']) { ?> <footer> <ul class="kp-meta-post list-inline"> <?php $is_metadata_first = true; foreach ($metadata as $key => $val) { if ($val) { $class = $is_metadata_first ? 'metadata-first' : ''; $is_metadata_first = false; switch ($key) { case 'date': printf('<li class="%s">%s<span>%s</span></li>', $class, KopaIcon::getIconDatetime(), get_the_date()); break; case 'comments': ?> <li class="<?php echo $class; ?> "><?php echo KopaIcon::getIconComment(); ?> <span><?php comments_popup_link(__('No Comment', kopa_get_domain()), __('1 Comment', kopa_get_domain()), __('% Comments', kopa_get_domain()), '', __('0 Comment', kopa_get_domain())); ?> </span></li> <?php break; } } } ?> </ul> </footer> <?php } ?> </li> <?php } $sub_loop_index++; } wp_reset_postdata(); ?> </ul> <?php } ?> </div> <?php } else { _e('Posts not found. Pleae config this widget again!', kopa_get_domain()); } echo $after_widget; }
<li><span lang="#tab-social-links"><?php _e('Social Links', kopa_get_domain()); ?> </span></li> <li><span lang="#tab-custom-css"><?php _e('Custom CSS', kopa_get_domain()); ?> </span></li> </ul><!--tabs--> </div><!--kopa-nav--> <div class="kopa-content"> <div class="kopa-page-header clearfix"> <div class="pull-left"> <h4><?php echo KopaIcon::getIcon('cog'); _e('Theme Options', kopa_get_domain()); ?> </h4> </div> <div class="pull-right"> <div class="kopa-copyrights"> <span><?php _e('Visit author URL:', kopa_get_domain()); ?> </span><a href="http://kopatheme.com" target="_blank">http://kopatheme.com</a> </div><!--="kopa-copyrights--> </div> </div><!--kopa-page-header--> <div class="kopa-actions clearfix">
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; } $dribbble_url = esc_url(kopa_get_option('kopa_theme_options_social_links_dribbble_url')); $gplus_url = esc_url(kopa_get_option('kopa_theme_options_social_links_gplus_url')); $facebook_url = esc_url(kopa_get_option('kopa_theme_options_social_links_facebook_url')); $twitter_url = esc_url(kopa_get_option('kopa_theme_options_social_links_twitter_url')); $rss_url = kopa_get_option('kopa_theme_options_social_links_rss_url'); $flickr_url = esc_url(kopa_get_option('kopa_theme_options_social_links_flickr_url')); $youtube_url = esc_url(kopa_get_option('kopa_theme_options_social_links_youtube_url')); $social_link_target = kopa_get_option('kopa_theme_options_social_link_target'); ?> <ul class="clearfix"> <!-- dribbble --> <?php if (!empty($dribbble_url)) { ?> <li><a href="<?php echo $dribbble_url; ?> " target="<?php echo $social_link_target; ?> "><?php echo KopaIcon::getIcon('dribbble'); ?> </a></li> <?php } ?> <!-- google plus --> <?php if (!empty($gplus_url)) { ?> <li><a href="<?php echo $gplus_url; ?> " target="<?php echo $social_link_target; ?> "><?php echo KopaIcon::getIcon('google-plus'); ?> </a></li> <?php } ?> <!-- facebook --> <?php if (!empty($facebook_url)) { ?> <li><a href="<?php echo $facebook_url; ?> " target="<?php echo $social_link_target; ?> "><?php echo KopaIcon::getIcon('facebook'); ?> </a></li> <?php } ?> <!-- twitter --> <?php if (!empty($twitter_url)) { ?> <li><a href="<?php echo $twitter_url; ?> " target="<?php echo $social_link_target; ?> "><?php echo KopaIcon::getIcon('twitter'); ?> </a></li> <?php } ?> <!-- rss --> <?php if ($rss_url != 'HIDE') { if (empty($rss_url)) { $rss_url = get_bloginfo('rss2_url'); } else { $rss_url = esc_url($rss_url); } ?> <li><a href="<?php echo $rss_url; ?> " target="<?php echo $social_link_target; ?> "><?php echo KopaIcon::getIcon('rss'); ?> </a></li> <?php } // endif ?> <!-- flickr --> <?php if (!empty($flickr_url)) { ?> <li><a href="<?php echo $flickr_url; ?> " target="<?php echo $social_link_target; ?> "><?php echo KopaIcon::getIcon('flickr'); ?> </a></li> <?php } ?> <!-- youtube --> <?php if (!empty($youtube_url)) { ?> <li><a href="<?php echo $youtube_url; ?> " target="<?php echo $social_link_target; ?> "><?php echo KopaIcon::getIcon('youtube'); ?> </a></li> <?php } ?> </ul> <?php echo $after_widget; }
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); $query_args = array(); $query_args['categories'] = empty($instance['categories']) ? array() : $instance['categories']; $query_args['posts_per_page'] = isset($instance['number_of_article']) ? $instance['number_of_article'] : -1; $query_args['orderby'] = isset($instance['orderby']) ? $instance['orderby'] : 'latest'; $display_type = isset($instance['display_type']) ? $instance['display_type'] : 'ranking'; $categories = get_terms('category'); echo $before_widget; if (!empty($title)) { echo $before_title . $title . $after_title; } $posts = kopa_widget_posttype_build_query($query_args); if (!empty($instance['categories']) && $posts->have_posts()) { ?> <div class="list-container-1"> <ul class="tabs-1 clearfix"> <?php $cat_index = 1; foreach ($categories as $category) { if (in_array($category->term_id, $instance['categories'])) { ?> <li <?php echo $cat_index == 1 ? ' class="active"' : ''; ?> ><a href="#<?php echo $this->get_field_id('tab') . '-' . $category->term_id; ?> "><?php echo $category->name; ?> </a></li> <?php } $cat_index++; // increase category index by 1 } ?> </ul><!--tabs-1--> </div> <div class="tab-container-1"> <?php foreach ($instance['categories'] as $cat_ID) { $cat_posts = new WP_Query(array('cat' => $cat_ID, 'posts_per_page' => $instance['number_of_article'])); if ($cat_posts->have_posts()) { ?> <div class="tab-content-1 kp-post-format <?php echo $display_type == 'thumbnail' ? 'kp-thumbnail-style' : ''; ?> " id="<?php echo $this->get_field_id('tab') . '-' . $cat_ID; ?> "> <ul> <?php $post_index = 1; while ($cat_posts->have_posts()) { $cat_posts->the_post(); $thumbnail = wp_get_attachment_image(get_post_thumbnail_id(), 'kopa-image-size-3'); if ($post_index == 1) { $index_class = 'kp-1st-post'; } elseif ($post_index == 2) { $index_class = 'kp-2nd-post'; } elseif ($post_index == 3) { $index_class = 'kp-3rd-post'; } else { $index_class = 'kp-nth-post'; } ?> <li> <article class="entry-item clearfix"> <?php if ($display_type == 'ranking') { ?> <span class="entry-thumb <?php echo $index_class; ?> "><?php echo $post_index; ?> </span> <?php } else { ?> <span class="entry-thumb"><a href="<?php the_permalink(); ?> "><?php if (has_post_thumbnail()) { echo $thumbnail; } // 53 x 53 ?> </a></span> <?php } // endif $display_type == ranking ?> <div class="entry-content"> <h4 class="entry-title"><a href="<?php the_permalink(); ?> "><?php echo get_the_title(); ?> </a></h4> <span class="entry-date"><span class="kopa-minus"></span><?php the_time(get_option('date_format')); ?> </span> <?php if (get_post_format() == 'video') { echo KopaIcon::getIcon('video-icon fa fa-video-camera', 'span'); } ?> </div> </article> </li> <?php $post_index++; // increase post index by 1 } ?> </ul> </div><!--tab-content-1--> <?php } wp_reset_postdata(); } ?> </div><!--tab-container-1--> <?php } // endif $posts->have_posts() wp_reset_postdata(); echo $after_widget; }
} ?> <!-- flickr --> <?php if ($kopa_flickr_url) { echo sprintf('<li><a title="Flickr" href="%2$s" target="_blank" rel="nofollow" >%1$s</a></li>', KopaIcon::getIcon('flickr'), $kopa_flickr_url); } ?> <!-- rss --> <?php if (empty($kopa_rss_url)) { echo sprintf('<li><a title="RSS" href="%2$s" target="_blank" rel="nofollow" >%1$s</a></li>', KopaIcon::getIcon('rss'), get_bloginfo('rss2_url')); } elseif ($kopa_rss_url != 'HIDE') { echo sprintf('<li><a href="%2$s" target="_blank" rel="nofollow" >%1$s</a></li>', KopaIcon::getIcon('rss'), esc_url($kopa_rss_url)); } ?> </ul><!--social-links--> <div class="sb-search-wrapper"> <div id="sb-search" class="sb-search"> <form method="get" action="<?php echo esc_url(home_url()); ?> "> <input class="sb-search-input" placeholder="<?php _e('Enter your search term...', kopa_get_domain()); ?> " type="text" value="" name="s" id="search"> <input class="sb-search-submit" type="submit" value="">
function kopa_ajax_load_quick_sort_articles() { if (!wp_verify_nonce($_POST['wpnonce'], 'kopa_load_quick_sort_articles')) { echo null; die; } $output = ''; $offset = $_POST['offset']; $categories = $_POST['categories']; $categories = explode(',', $categories); $posts_per_page = $_POST['posts_per_page']; $orderby = $_POST['orderby']; $post__not_in = explode(',', $_POST['post__not_in']); $query_args = array('category__in' => $categories, 'posts_per_page' => $posts_per_page); if ($orderby != 'random') { $query_args['offset'] = $offset; } switch ($orderby) { case 'popular': $query_args['meta_key'] = 'kopa_' . kopa_get_domain() . '_total_view'; $query_args['orderby'] = 'meta_value_num'; break; case 'most_comment': $query_args['orderby'] = 'comment_count'; break; case 'random': $query_args['orderby'] = 'rand'; $query_args['post__not_in'] = $post__not_in; break; default: $query_args['orderby'] = 'date'; break; } $posts = new WP_Query($query_args); if ($posts->have_posts()) { while ($posts->have_posts()) { $posts->the_post(); array_push($post__not_in, get_the_ID()); $post_terms = get_the_terms(get_the_ID(), 'category'); $data_category = array(); $has_printed_thumbnail = false; if ('video' == get_post_format()) { $data_icon = 'video'; // icon-film-2 } elseif ('gallery' == get_post_format()) { $data_icon = 'images'; // icon-images } elseif ('audio' == get_post_format()) { $data_icon = 'music'; // icon-music } else { $data_icon = 'pencil'; // icon-pencil } foreach ($post_terms as $post_term) { if (in_array($post_term->term_id, $categories)) { array_push($data_category, $post_term->slug); } } if (!empty($data_category)) { $data_category = implode(' ', $data_category); } else { $data_category = ''; } $output .= '<article class="element ' . $data_category . '" data-category="' . $data_category . '">'; $output .= '<div class=top-line>'; $output .= '</div><div class=entry-thumb>'; if (has_post_thumbnail()) { $output .= wp_get_attachment_image(get_post_thumbnail_id(), 'kopa-image-size-6'); // 496 x 346 $has_printed_thumbnail = true; } elseif ('video' == get_post_format()) { $video = kopa_content_get_video(get_the_content()); if (isset($video[0])) { $video = $video[0]; } else { $video = ''; } if (isset($video['type']) && isset($video['url'])) { $video_thumbnail_url = kopa_get_video_thumbnails_url($video['type'], $video['url']); $output .= '<img src="' . esc_url($video_thumbnail_url) . '" alt="' . get_the_title() . '">'; $has_printed_thumbnail = true; } } elseif ('gallery' == get_post_format()) { $gallery_ids = kopa_content_get_gallery_attachment_ids(get_the_content()); if (!empty($gallery_ids)) { foreach ($gallery_ids as $id) { if (wp_attachment_is_image($id)) { $output .= wp_get_attachment_image($id, 'kopa-image-size-6'); // 496 x 346 $has_printed_thumbnail = true; break; } } } } // endif has_post_thumbnail if ($has_printed_thumbnail) { $output .= '<a href="' . get_permalink() . '">' . KopaIcon::getIcon('long-arrow-right') . '</a>'; } $output .= '</div>'; $output .= '<div class=entry-content><header>'; $output .= '<h4 class="entry-title clearfix">' . KopaIcon::getIcon($data_icon, 'span') . '<a href="' . get_permalink() . '">' . get_the_title() . '</a></h4>'; $output .= '<div class="meta-box">'; $output .= '<span class="entry-date">' . get_the_time(get_option('date_format')) . '</span> '; $output .= '<span class="entry entry-author">' . __('By', kopa_get_domain()) . ' <a href="' . get_author_posts_url(get_the_author_meta('ID')) . '" title="' . __('Posts by', kopa_get_domain()) . ' ' . get_the_author() . '" rel="author">' . get_the_author() . '</a></span>'; $output .= '</div></header>'; $output .= '<p>' . get_the_excerpt() . '</p>'; $output .= '<footer class=clearfix>'; $output .= '<div class=meta-box>'; $output .= '<span class=entry-comments>' . KopaIcon::getIcon('comment', 'span'); if (comments_open()) { $output .= '<a href="' . get_comments_link() . '" title="' . __('Comment on') . ' ' . get_the_title() . '">' . get_comments_number() . '</a>'; } else { $output .= '<span>' . __('Off', kopa_get_domain()) . '</span>'; } $output .= '</span> '; if ('show' == get_option('kopa_theme_options_view_count_status', 'show') && true == get_post_meta(get_the_ID(), 'kopa_' . kopa_get_domain() . '_total_view', true)) { $output .= '<span class=entry-view>' . KopaIcon::getIcon('view', 'span') . get_post_meta(get_the_ID(), 'kopa_' . kopa_get_domain() . '_total_view', true) . '</span>'; } $output .= '</div> <!-- .meta-box -->'; $post_rating = round(get_post_meta(get_the_ID(), 'kopa_editor_user_total_all_rating_' . kopa_get_domain(), true)); if (!empty($post_rating)) { $output .= '<ul class="kopa-rating clearfix">'; for ($i = 0; $i < $post_rating; $i++) { $output .= '<li>' . KopaIcon::getIcon('star', 'span') . '</li>'; } for ($i = 0; $i < 5 - $post_rating; $i++) { $output .= '<li>' . KopaIcon::getIcon('star2', 'span') . '</li>'; } $output .= '</ul>'; } $output .= '</footer>'; $output .= '</div> <!-- entry-content -->'; $output .= '<div class=bottom-line></div>'; $output .= '</article>'; } wp_reset_postdata(); } else { echo null; die; } $responses_data = array('output' => $output, 'post__not_in' => implode(',', $post__not_in)); echo json_encode($responses_data); die; }
/** * @package Kopa * @subpackage Core * @author thethangtran <*****@*****.**> * @since 1.0.0 */ function kopa_get_related_posts() { if (is_single()) { $get_by = get_option('post_related_posts_get_by', 'post_tag'); $limit = (int) KopaOptions::get_option('post_related_posts_limit', 4); if ($limit > 0) { global $post; $taxs = array(); if ('category' == $get_by) { $cats = get_the_category($post->ID); if ($cats) { $ids = array(); foreach ($cats as $cat) { $ids[] = $cat->term_id; } $taxs[] = array('taxonomy' => 'category', 'field' => 'id', 'terms' => $ids); } } else { $tags = get_the_tags($post->ID); if ($tags) { $ids = array(); foreach ($tags as $tag) { $ids[] = $tag->term_id; } $taxs[] = array('taxonomy' => 'post_tag', 'field' => 'id', 'terms' => $ids); } } if ($taxs) { $related_args = array('tax_query' => $taxs, 'post__not_in' => array($post->ID), 'posts_per_page' => $limit); $related_posts = new WP_Query($related_args); if ($related_posts->have_posts()) { ?> <div class="related-article"> <h3 class="widget-title"><span><span><span><?php _e('Related articles', kopa_get_domain()); ?> </span></span></span></h3> <div class="widget-content"> <div class="owl-carousel owl-carousel-related"> <?php while ($related_posts->have_posts()) { $related_posts->the_post(); $post_id = get_the_ID(); $post_url = get_permalink(); $post_title = get_the_title(); ?> <div <?php post_class('item'); ?> > <?php if (has_post_thumbnail()) { $image_croped = KopaImage::get_post_image_src($post_id, 'size_08'); ?> <a href="<?php echo $post_url; ?> "><img src="<?php echo $image_croped; ?> " alt="<?php echo $post_title; ?> " /></a> <?php } ?> <div class="kp-caption"> <h4 class="post-title"><a href="<?php echo $post_url; ?> "><?php echo $post_title; ?> </a></h4> <ul class="kp-meta-post list-inline"> <li><?php echo KopaIcon::getIconDatetime(); ?> <span><?php echo get_the_date(); ?> </span></li> <li><?php echo KopaIcon::getIconComment(); ?> <span><?php comments_popup_link(__('No Comment', kopa_get_domain()), __('1 Comment', kopa_get_domain()), __('% Comments', kopa_get_domain()), '', __('0 Comment', kopa_get_domain())); ?> </span></li> </ul> <span class="kp-meta-post"><?php echo get_the_date(); ?> </span> </div> </div> <?php } ?> </div> </div> </div> <?php } wp_reset_postdata(); } } } }
function kopa_layout_page($_kopa_template_id) { global $KOPA_LAYOUT; global $KOPA_TEMPLATE_HIERARCHY; global $KOPA_SIDEBAR_POSITION; global $KOPA_SETTING; global $KOPA_SIDEBAR; wp_nonce_field("load_layout_setting", "nonce_id"); wp_nonce_field("save_layout_setting", "nonce_id_save"); ?> <div id="kopa-admin-wrapper" class="clearfix"> <div id="kopa-loading-gif"></div> <input type="hidden" id="kopa_template_id" value="<?php echo $_kopa_template_id; ?> "> <?php if ($KOPA_TEMPLATE_HIERARCHY) { echo '<div class="kopa-nav list-container"> <ul class="tabs clearfix">'; foreach ($KOPA_TEMPLATE_HIERARCHY as $kopa_template_key => $kopa_template_value) { if ($kopa_template_key === $_kopa_template_id) { $_active = "class='active'"; } else { $_active = ''; } echo '<li ' . $_active . '><span title="' . $kopa_template_key . '" onclick="load_layout_setting(jQuery(this))">' . $kopa_template_value['title'] . '</span></li>'; } echo '</ul><!--tabs---> </div><!--kopa-nav-->'; } ?> <div class="kopa-content"> <div class="kopa-page-header clearfix"> <div class="pull-left"> <h4><?php echo KopaIcon::getIcon('cog'); ?> Layout And Sidebar Manager</h4> </div> <div class="pull-right"> <div class="kopa-copyrights"> <span>Visit author URL: </span><a href="<?php echo KOPA_URL; ?> " target="_blank"><?php echo KOPA_URL; ?> </a> </div><!--="kopa-copyrights--> </div> </div><!--kopa-page-header--> <div class="tab-container"> <div class="kopa-content-box tab-content kopa-content-main-box" id="<?php echo $_kopa_template_id; ?> "> <div class="kopa-actions clearfix"> <div class="kopa-button"> <span class="btn btn-primary" onclick="save_layout_setting(jQuery(this))"><?php echo KopaIcon::getIcon('check-circle'); ?> Save</span> </div> </div><!--kopa-actions--> <div class="kopa-box-head"> <?php echo KopaIcon::getIcon('hand-right'); ?> <span class="kopa-section-title"><?php echo $KOPA_TEMPLATE_HIERARCHY[$_kopa_template_id]['title']; ?> </span> </div><!--kopa-box-head--> <div class="kopa-box-body clearfix"> <div class="kopa-layout-box pull-left"> <div class="kopa-select-layout-box kopa-element-box"> <span class="kopa-component-title">Select the layout</span> <select class="kopa-layout-select" onchange="show_onchange(jQuery(this));" autocomplete="off"> <?php foreach ($KOPA_TEMPLATE_HIERARCHY[$_kopa_template_id]['layout'] as $keys => $value) { echo '<option value="' . $value . '"'; /* foreach ($KOPA_SETTING as $kopa_setting_key => $kopa_setting_value) { if ($kopa_setting_key == $_kopa_template_id && $kopa_setting_value[layout_id] == $value) { echo 'selected="selected"'; } } */ if ($value === $KOPA_SETTING[$_kopa_template_id]['layout_id']) { echo 'selected="selected"'; } echo '>' . $KOPA_LAYOUT[$value]['title'] . '</option>'; } ?> </select> </div><!--kopa-select-layout-box--> <?php foreach ($KOPA_TEMPLATE_HIERARCHY[$_kopa_template_id]['layout'] as $keys => $value) { foreach ($KOPA_LAYOUT as $layout_key => $layout_value) { if ($layout_key == $value) { ?> <div class="<?php echo 'kopa-sidebar-box-wrapper sidebar-position-' . $layout_key; ?> "> <?php foreach ($layout_value['positions'] as $postion_key => $postion_id) { ?> <div class="kopa-sidebar-box kopa-element-box"> <span class="kopa-component-title"><?php echo $KOPA_SIDEBAR_POSITION[$postion_id]['title']; ?> </span> <label class="kopa-label">Select sidebars</label> <?php echo '<select class="kopa-sidebar-select" autocomplete="off">'; foreach ($KOPA_SIDEBAR as $sidebar_list_key => $sidebar_list_value) { $__selected_sidebar = ''; if ($layout_key === $KOPA_SETTING[$_kopa_template_id]['layout_id']) { if ($sidebar_list_key === $KOPA_SETTING[$_kopa_template_id]['sidebars'][$postion_key]) { $__selected_sidebar = 'selected="selected"'; } } echo '<option value="' . $sidebar_list_key . '" ' . $__selected_sidebar . '>' . $sidebar_list_value . '</option>'; $__selected_sidebar = ''; } echo '</select>'; ?> </div><!--kopa-sidebar-box--> <?php } ?> </div><!--kopa-sidebar-box-wrapper--> <?php } } } ?> </div><!--kopa-layout-box--> <div class="kopa-thumbnails-box pull-right"> <?php foreach ($KOPA_TEMPLATE_HIERARCHY[$_kopa_template_id]['layout'] as $thumbnails_key => $thumbnails_value) { ?> <image class="responsive-img <?php echo ' kopa-cpanel-thumbnails kopa-cpanel-thumbnails-' . $thumbnails_value; ?> " src="<?php echo KOPA_CPANEL_IMAGE_DIR . $KOPA_LAYOUT[$thumbnails_value]['thumbnails']; ?> " class="img-polaroid" alt=""> <?php } ?> </div><!--kopa-thumbnails-box--> </div><!--kopa-box-body--> <div class="kopa-actions kopa-bottom-action-bar clearfix"> <div class="kopa-button"> <span class="btn btn-primary" onclick="save_layout_setting(jQuery(this))"><?php echo KopaIcon::getIcon('check-circle'); ?> Save</span> </div> </div> </div><!--kopa-content-box--> </div><!--tab-container--> </div><!--kopa-content--> </div><!--kopa-admin-wrapper--> <?php }
<form method="get" id="<?php echo "search-form-" . rand(0, 9999); ?> " class="search-form clearfix" action="<?php echo trailingslashit(home_url()); ?> "> <div class="form-group pull-left"> <input type="text" name="s" class="form-control" onBlur="if ('' === this.value) this.value = this.defaultValue;" onFocus="if (this.value === this.defaultValue) this.value = '';" value="<?php _e('Search...', kopa_get_domain()); ?> " > </div> <button type="submit" class="search-submit"><?php echo KopaIcon::getIcon('fa fa-search'); ?> </button> </form>
case 'comments': ?> <li class="<?php echo $class; ?> "><?php echo KopaIcon::getIconComment(); ?> <span><?php comments_popup_link(__('No Comment', kopa_get_domain()), __('1 Comment', kopa_get_domain()), __('% Comments', kopa_get_domain()), '', __('0 Comment', kopa_get_domain())); ?> </span></li> <?php break; case 'views': printf('<li class="%s">%s<span>%s</span></li>', $class, KopaIcon::getIconView(), KopaUtil::get_views($post_id, true)); break; case 'likes': printf('<li class="%s">%s</li>', $class, KopaUtil::kopa_get_like_button($post_id, true)); break; } } } ?> </ul> <?php if ('excerpt' == $exceprt_type) { if (has_excerpt()) { printf('<p>%s</p>', get_the_excerpt()); } else { global $post;
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['posts_per_page'] = 4; $query = $this->build_query($instance); $posts = new WP_Query($query); if ($posts->have_posts()) { ?> <div class="widget-content container clearfix"> <div class="owl-slider-col-left pull-left"> <?php $is_first = true; $loop_index = 0; while ($posts->have_posts()) { $posts->the_post(); if (has_post_thumbnail()) { $classes = array('owl-slider-navigation-post-title'); if ($is_first) { $classes[] = 'active'; $classes[] = 'first'; $is_first = false; } ?> <p class="<?php echo implode(' ', $classes); ?> " data-index="<?php echo $loop_index; ?> "> <?php echo get_the_title(); ?> </p> <?php $loop_index++; } } ?> </div> <div class="owl-slider-col-center pull-left"> <div class="owl-carousel" data-transition="<?php echo $instance['transition_type']; ?> "> <?php $is_first = true; global $post; while ($posts->have_posts()) { $posts->the_post(); $post_id = get_the_ID(); $post_title = get_the_title(); $post_url = get_permalink(); $post_format = get_post_format(); if (has_post_thumbnail()) { $classes = array('owl-slider-single-slide'); if ($is_first) { $classes[] = 'active'; $classes[] = 'first'; $classes[] = 'synced'; $is_first = false; } $image_croped = KopaImage::get_post_image_src($post_id, 'size_11'); ?> <div class="<?php echo implode(' ', $classes); ?> "> <?php if ('video' == $post_format) { $video = KopaUtil::get_video($post->post_content, array('youtube', 'vimeo')); if ($video) { $url = ''; if ('youtube' == $video['type']) { $url = 'http://www.youtube.com/watch?v=' . $video['id']; } else { if ('vimeo' == $video['type']) { $url = 'https://vimeo.com/' . $video['id']; } } printf('<a class="kss-icon kss-icon-play" href="%s"><span class="fa fa-play"></span></a>', $url); } } ?> <img src="<?php echo $image_croped; ?> " alt="<?php echo $post_title; ?> "> <a href="<?php echo $post_url; ?> " title="<?php echo $post_title; ?> "><?php echo $post_title; ?> </a> </div> <?php } } ?> </div> </div> <div class="owl-slider-col-right pull-left"> <div class="owl-carousel"> <?php $is_first = true; while ($posts->have_posts()) { $posts->the_post(); $post_id = get_the_ID(); $post_title = get_the_title(); $post_url = get_permalink(); $post_format = get_post_format(); if (has_post_thumbnail()) { $classes = array('owl-slider-single-slide-detail'); if ($is_first) { $classes[] = 'first'; $classes[] = 'synced'; $is_first = false; } ?> <div class="<?php echo implode(' ', $classes); ?> "> <span class="kopa-icon-post-format"><?php echo KopaIcon::getIconPostFormat($post_format, 'span'); ?> </span> <?php if ('true' != $instance['is_hide_created_date']) { ?> <span class="kopa-date"><?php echo get_the_date('M, j'); ?> <br/><?php echo get_the_date('Y'); ?> </span> <?php } ?> <?php if ('true' != $instance['is_hide_views'] || 'true' != $instance['is_hide_comments'] || 'true' != $instance['is_hide_views']) { ?> <ul class="kopa-metadata"> <?php if ('true' != $instance['is_hide_comments']) { ?> <li class="metadata-first"><i class="fa fa-comment"></i><span><?php echo KopaUtil::get_comments($post_id, true); ?> </span></li> <?php } ?> <?php if ('true' != $instance['is_hide_views']) { ?> <li><?php echo KopaIcon::getIconView(); ?> <span><?php echo KopaUtil::get_views($post_id, false); ?> </span></li> <?php } ?> <?php if ('true' != $instance['is_hide_likes']) { ?> <li class="metadata-last"><?php echo KopaIcon::getIconLike(); ?> <span><?php echo KopaUtil::get_likes($post_id, false); ?> </span></li> <?php } ?> </ul> <?php } ?> </div> <?php } } ?> </div> </div> </div> <?php } wp_reset_postdata(); echo $after_widget; }
" ><?php echo KopaIcon::getIcon('google-plus'); ?> </a></li> <?php } ?> <?php if ($author_flickr) { ?> <li><a href="<?php echo $author_flickr; ?> " ><?php echo KopaIcon::getIcon('flickr'); ?> </a></li> <?php } ?> </ul> </div><!--author-content--> </div><!--about-author-detail--> </div><!--about-author--> <?php } ?> <?php kopa_get_related_articles();
<?php include_once trailingslashit(get_template_directory()) . '/library/includes/cpanel/theme-options/blog-slider.php'; ?> <?php include_once trailingslashit(get_template_directory()) . '/library/includes/cpanel/theme-options/post.php'; ?> <?php include_once trailingslashit(get_template_directory()) . '/library/includes/cpanel/theme-options/social-links.php'; ?> <?php include_once trailingslashit(get_template_directory()) . '/library/includes/cpanel/theme-options/custom-css.php'; ?> <div class="kopa-actions kopa-bottom-action-bar clearfix"> <div class="kopa-button"> <span class="btn btn-primary" onclick="kopa_save_general_setting(jQuery(this));"><?php echo KopaIcon::getIcon('check-circle'); _e('Save', kopa_get_domain()); ?> </span> </div> <div class="progress progress-striped active"> <div class="bar" style="width: 100%;"></div> </div> </div> </div><!--tab-container--> </div><!--kopa-content--> <div class="clear"></div> </form> </div><!--kopa-admin-wrapper-->
function kopa_edit_extra_category_fields($tag) { //check for existing featured ID $t_id = $tag->term_id; $kopa_category_setting_key = "kopa_category_setting_" . $t_id; global $KOPA_SETTING; $kopa_category_setting = get_option($kopa_category_setting_key, array()); $kopa_disable = ''; if (empty($kopa_category_setting)) { $kopa_disable = ' disabled'; $kopa_checked = ''; $kopa_checked_value = "No"; $kopa_category_setting = $KOPA_SETTING["taxonomy"]; } else { $kopa_checked = 'checked ="checked"'; $kopa_disable = ''; $kopa_checked_value = "Yes"; } global $KOPA_TEMPLATE_HIERARCHY; global $KOPA_LAYOUT; global $KOPA_SIDEBAR_POSITION; global $KOPA_SIDEBAR; wp_nonce_field("save_layout_setting", "nonce_id_save"); ?> <tr class="form-field"> <th scope="row" valign="top"> </th> <td> <div class="kopa-content-box tab-content kopa-content-main-box" id="kopa-category-edit" class="kopa-category-edit"> <div class="kopa-box-head clearfix"> <h4><?php echo KopaIcon::getIcon('cog'); ?> Custom Setting Layout and Sidebar?</h4> <input onchange="show_on_checked(jQuery(this));" autocomplete="off" type="checkbox" name="kopa_custom_layout_setting" id="kopa_custom_layout_setting" class="kopa_custom_layout_setting" value="<?php echo $kopa_checked_value; ?> " <?php echo $kopa_checked; ?> > <label class="kopa-label">Check if you would like to use custom setting</label> </div><!--kopa-box-head--> <div class="kopa-box-body clearfix"> <div class="kopa-layout-box pull-left"> <div class="kopa-select-layout-box kopa-element-box"> <span class="kopa-component-title">Select the layout</span> <select name ="kopa_select_layout" class="kopa-layout-select" onchange="show_onchange(jQuery(this));" autocomplete="off" <?php echo $kopa_disable; ?> > <?php foreach ($KOPA_TEMPLATE_HIERARCHY['taxonomy']['layout'] as $keys => $value) { echo '<option value="' . $value . '"'; if ($value === $kopa_category_setting['layout_id']) { echo 'selected="selected"'; } echo '>' . $KOPA_LAYOUT[$value]['title'] . '</option>'; } ?> </select> </div><!--kopa-select-layout-box--> <?php foreach ($KOPA_TEMPLATE_HIERARCHY['taxonomy']['layout'] as $keys => $value) { foreach ($KOPA_LAYOUT as $layout_key => $layout_value) { if ($layout_key == $value) { ?> <div class="<?php echo 'kopa-sidebar-box-wrapper sidebar-position-' . $layout_key; ?> "> <?php foreach ($layout_value['positions'] as $postion_key => $postion_id) { ?> <div class="kopa-sidebar-box kopa-element-box"> <span class="kopa-component-title"><?php echo $KOPA_SIDEBAR_POSITION[$postion_id]['title']; ?> </span> <label class="kopa-label">Select sidebars</label> <?php echo '<select class="kopa-sidebar-select" autocomplete="off" ' . $kopa_disable . '>'; foreach ($KOPA_SIDEBAR as $sidebar_list_key => $sidebar_list_value) { $__selected_sidebar = ''; if ($layout_key === $kopa_category_setting['layout_id']) { if ($sidebar_list_key === $kopa_category_setting['sidebars'][$postion_key]) { $__selected_sidebar = 'selected="selected"'; } } echo '<option value="' . $sidebar_list_key . '" ' . $__selected_sidebar . '>' . $sidebar_list_value . '</option>'; $__selected_sidebar = ''; } echo '</select>'; ?> </div><!--kopa-sidebar-box--> <?php } ?> </div><!--kopa-sidebar-box-wrapper--> <?php } } } ?> </div><!--kopa-layout-box--> <div class="kopa-thumbnails-box pull-right"> <?php foreach ($KOPA_TEMPLATE_HIERARCHY['taxonomy']['layout'] as $thumbnails_key => $thumbnails_value) { ?> <image class="responsive-img <?php echo ' kopa-cpanel-thumbnails kopa-cpanel-thumbnails-' . $thumbnails_value; ?> " src="<?php echo KOPA_CPANEL_IMAGE_DIR . $KOPA_LAYOUT[$thumbnails_value]['thumbnails']; ?> " class="img-polaroid" alt=""> <?php } ?> </div><!--kopa-thumbnails-box--> </div><!--kopa-box-body--> </div><!--kopa-content-box--> </td> </tr> <?php }
?> <tr <?php if ($kopa_sidebar_element_key === "sidebar_hide") { echo 'style ="display:none;"'; } ?> > <td><?php echo $kopa_sidebar_element_value; ?> </td> <td><a onclick="kopa_remove_sidebar_clicked(jQuery(this), '<?php echo $kopa_sidebar_element_key; ?> ')" title="" lang="" rel="tooltip" class="button button-basic button-icon" data-original-title="Remove"><?php echo KopaIcon::getIcon('trash'); ?> </a></td> </tr> <?php } } ?> </tbody> </table> <?php } else { ?> <label id="kopa-nosidebar-label" class="kopa-label">No sidebar defined</label> <table class="table table-nomargin hidden"> <thead>
echo KopaIcon::getIconComment(); ?> <span><?php comments_popup_link(__('No Comment', kopa_get_domain()), __('1 Comment', kopa_get_domain()), __('% Comments', kopa_get_domain()), '', __('0 Comment', kopa_get_domain())); ?> </span></li> <?php break; case 'views': printf('<li class="singular-view-count %s">%s<span>%s</span></li>', $class, KopaIcon::getIconView(), KopaUtil::get_views($post_id, true)); break; case 'likes': printf('<li class="%s">%s</li>', $class, KopaUtil::kopa_get_like_button($post_id, true)); break; case 'shares': printf('<li class="singular-shares %s"><a class="addthis_button_compact" addthis:url="%s" href="#" rel="nofollow">%s %s</a></li>', $class, $post_url, KopaIcon::getIconShare(), __('Share', kopa_get_domain())); break; } } } ?> </ul> </div> </header> <?php if (has_post_thumbnail()) { $exp1 = empty($post_format) && $metadata['thumb']; $exp2 = $post_format && $metadata['thumb_other']; if ($exp1 || $exp2) {
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; } $query = $this->build_query($instance); $posts = new WP_Query($query); if ($posts->have_posts()) { global $post; ?> <div class="widget-content clearfix"> <?php $metadata = array(); $metadata['date'] = 'true' != $instance['is_hide_created_date'] ? true : false; $metadata['comments'] = 'true' != $instance['is_hide_comments'] ? true : false; $metadata['views'] = 'true' != $instance['is_hide_views'] ? true : false; $metadata['likes'] = 'true' != $instance['is_hide_likes'] ? true : false; while ($posts->have_posts()) { $posts->the_post(); $post_id = get_the_ID(); $post_title = get_the_title(); $post_url = get_permalink(); ?> <div <?php post_class('item'); ?> > <?php if (has_category()) { ?> <h5 class="post-cat"> <?php the_category(', '); ?> </h5> <?php } ?> <?php if ('true' != $instance['is_hide_title']) { ?> <h4 class="post-title"><a href="<?php echo $post_url; ?> "><?php echo $post_title; ?> </a></h4> <?php } ?> <?php if ('true' != $instance['is_hide_excerpt']) { if ((int) $instance['excerpt_character_limit'] > 0) { $excerpt = KopaUtil::substr($post->post_content, (int) $instance['excerpt_character_limit']); echo $excerpt ? sprintf('<p>%s</p>', $excerpt) : ''; } else { the_excerpt(); } } ?> <?php if ($metadata['date'] || $metadata['comments'] || $metadata['views'] || $metadata['likes']) { ?> <footer> <ul class="kp-meta-post list-inline"> <?php $is_metadata_first = true; foreach ($metadata as $key => $val) { if ($val) { $class = $is_metadata_first ? 'metadata-first' : ''; $is_metadata_first = false; switch ($key) { case 'date': printf('<li class="%s">%s<span>%s</span></li>', $class, KopaIcon::getIconDatetime(), get_the_date()); break; case 'comments': ?> <li class="<?php echo $class; ?> "><?php echo KopaIcon::getIconComment(); ?> <span><?php comments_popup_link(__('No Comment', kopa_get_domain()), __('1 Comment', kopa_get_domain()), __('% Comments', kopa_get_domain()), '', __('0 Comment', kopa_get_domain())); ?> </span></li> <?php break; case 'views': printf('<li class="%s">%s<span>%s</span></li>', $class, KopaIcon::getIconView(), KopaUtil::get_views($post_id, true)); break; case 'likes': printf('<li class="%s">%s</li>', $class, KopaUtil::kopa_get_like_button($post_id, true)); break; } } } ?> </ul> </footer> <?php } ?> </div> <?php } ?> </div> <?php } else { _e('Posts not found. Pleae config this widget again!', kopa_get_domain()); } wp_reset_postdata(); echo $after_widget; }
?> </span> <span class="entry-author">, <?php _e('by', kopa_get_domain()); ?> <?php the_author_posts_link(); ?> </span> <span class="entry-comments"><?php echo KopaIcon::getIcon('comment', 'span'); comments_popup_link(); ?> </span> <span class="entry-view"><?php echo KopaIcon::getIcon('view', 'span'); //echo kopa_get_view_count( get_the_ID() ); ?> </span> </header> <div class="clear"></div> <div class="elements-box mt-20"> <?php //$content = get_the_content(); //$content = preg_replace('/\[gallery.*]/', '', $content); //$content = apply_filters( 'the_content', $content ); //$content = str_replace(']]>', ']]>', $content); //echo $content; the_content();
function fastnews_kopa_icon_get_icon($html, $icon_class, $icon_tag) { $classes = ''; switch ($icon_class) { case 'facebook': $classes = 'fa fa-facebook'; break; case 'facebook2': $classes = 'fa fa-facebook-square'; break; case 'twitter': $classes = 'fa fa-twitter'; break; case 'twitter2': $classes = 'fa fa-twitter-square'; break; case 'google-plus': $classes = 'fa fa-google-plus'; break; case 'google-plus2': $classes = 'fa fa-google-plus-square'; break; case 'instagram': $classes = 'fa fa-instagram'; break; case 'youtube': $classes = 'fa fa-youtube'; break; case 'dribbble': $classes = 'fa fa-dribbble'; break; case 'flickr': $classes = 'fa fa-flickr'; break; case 'rss': $classes = 'fa fa-rss'; break; case 'linkedin': $classes = 'fa fa-linkedin'; break; case 'pinterest': $classes = 'fa fa-pinterest'; break; case 'email': $classes = 'fa fa-envelope'; break; case 'pencil': $classes = 'fa fa-pencil'; break; case 'date': $classes = 'fa fa-clock-o'; break; case 'comment': $classes = 'fa fa-comment'; break; case 'view': $classes = 'fa fa-eye'; break; case 'link': $classes = 'fa fa-link'; break; case 'film': $classes = 'fa fa-film'; break; case 'images': $classes = 'fa fa-picture-o'; break; case 'music': $classes = 'fa fa-music'; break; case 'long-arrow-right': $classes = 'fa fa-long-arrow-right'; break; case 'apple': $classes = 'fa fa-apple'; break; case 'star': $classes = 'fa fa-star'; break; case 'star2': $classes = 'fa fa-star-o'; break; case 'exit': $classes = 'fa fa-sign-out'; break; case 'folder': $classes = 'fa fa-folder'; break; case 'video': $classes = 'fa fa-video-camera'; break; case 'play': $classes = 'fa fa-play'; break; case 'spinner': $classes = 'fa fa-spinner'; break; case 'bug': $classes = 'fa fa-bug'; break; case 'tint': $classes = 'fa fa-tint'; break; case 'pause': $classes = 'fa fa-pause'; break; case 'crosshairs': $classes = 'fa fa-crosshairs'; break; case 'cog': $classes = 'fa fa-cog'; break; case 'check-circle': $classes = 'fa fa-check-circle-o'; break; case 'hand-right': $classes = 'fa fa-hand-o-right'; break; case 'plus-square': $classes = 'fa fa-plus-square'; break; case 'trash': $classes = 'fa fa-trash-o'; break; case 'arrow-circle-up': $classes = 'fa fa-arrow-circle-up'; break; case 'home': $classes = 'fa fa-home'; break; case 'volume': $classes = 'fa fa-volume-up'; break; case 'chevron-circle-right': $classes = 'fa fa-chevron-right'; break; case 'chevron-circle-left': $classes = 'fa fa-chevron-left'; break; } return KopaIcon::createHtml($classes, $icon_tag); }
function kopa_load_timeline_posts_fn($month, $year, $paged) { $args = array('date_query' => array('post_type' => array('post'), 'post_status' => array('publish'), 'ignore_sticky_posts' => true, array('year' => $year, 'month' => $month))); if ($paged) { $args['paged'] = $paged; } $posts = new WP_Query($args); $exceprt_type = KopaOptions::get_option('exceprt_type', 'limit'); $excerpt_limit = KopaOptions::get_option('excerpt_limit', 200, 'Int'); $metadata = array(); $metadata['date'] = false; $metadata['comments'] = KopaOptions::get_option('is_display_comments', true, 'Boolean'); $metadata['views'] = KopaOptions::get_option('is_display_views', true, 'Boolean'); $metadata['likes'] = KopaOptions::get_option('is_display_likes', true, 'Boolean'); $metadata['readmore'] = KopaOptions::get_option('is_display_readmore', true, 'Boolean'); global $post; while ($posts->have_posts()) { $posts->the_post(); $post_id = get_the_ID(); $post_title = get_the_title(); $post_url = get_permalink(); $post_format = get_post_format(); if (!is_sticky()) { ?> <div class="item clearfix"> <p class="kopa-timeline-date-small"><?php echo get_the_date(); ?> </p> <?php if (has_post_thumbnail()) { $image_full = KopaImage::get_post_image_src($post_id, 'full'); $image_croped = KopaImage::get_post_image_src($post_id, 'size_09'); ?> <div class="kopa-thumb"> <img src="<?php echo $image_croped; ?> " alt="<?php echo $post_title; ?> "/> <div class="mask"></div> <a href="<?php echo $post_url; ?> " class="icon-link fa fa-link fa-flip-horizontal"></a> <span class="icon-zoom-in fa fa-search-plus" onclick="KopaLightbox.open_image('<?php echo $image_full; ?> ');"></span> </div> <?php } ?> <div class="kp-caption"> <h4 class="post-title"><a href="<?php echo $post_url; ?> " title="<?php echo $post_title; ?> "><?php echo $post_title; ?> </a></h4> <ul class="kp-meta-post list-inline"> <?php $is_first = true; foreach ($metadata as $key => $val) { if ($val) { $class = $is_first ? 'metadata-first' : ''; $is_first = false; switch ($key) { case 'date': printf('<li class="%s">%s<span>%s</span></li>', $class, KopaIcon::getIconDatetime(), get_the_date()); break; case 'comments': ?> <li class="<?php echo $class; ?> "><?php echo KopaIcon::getIconComment(); ?> <span><?php comments_popup_link(__('No Comment', kopa_get_domain()), __('1 Comment', kopa_get_domain()), __('% Comments', kopa_get_domain()), '', __('0 Comment', kopa_get_domain())); ?> </span></li> <?php break; case 'views': printf('<li class="%s">%s<span>%s</span></li>', $class, KopaIcon::getIconView(), KopaUtil::get_views($post_id, true)); break; case 'likes': printf('<li class="%s">%s</li>', $class, KopaUtil::kopa_get_like_button($post_id, true)); break; } } } ?> </ul> <?php if ('excerpt' == $exceprt_type) { if (has_excerpt()) { printf('<p>%s</p>', get_the_excerpt()); } else { global $post; if (strpos($post->post_content, '<!--more-->')) { the_content(' '); } else { printf('<p>%s</p>', get_the_excerpt()); } } } elseif ('full' == $exceprt_type) { global $more; $more = true; the_content(); } else { if ($excerpt_limit) { $excerpt = KopaUtil::substr($post->post_content, $excerpt_limit); echo $excerpt ? sprintf('<p>%s</p>', $excerpt) : ''; } } ?> <?php if ($metadata['readmore'] && 'full' != $exceprt_type) { ?> <a href="<?php echo $post_url; ?> " class="read-more"><?php _e('Read more', kopa_get_domain()); ?> </a> <?php } ?> </div> <!-- kp-caption --> <div class="more-i"> <div class="more-time"> <span><?php echo get_the_date('M d'); ?> </span> <i><?php echo get_the_date('Y'); ?> </i> </div> <span></span> <?php echo KopaIcon::getIconPostFormat($post_format); ?> </div> <!-- more i --> </div> <?php } } wp_reset_postdata(); }
public static function get_html($query, $params, $paged = 1, $orderby = 'date') { global $post; $query['paged'] = (int) $paged; $posts = new WP_Query($query); while ($posts->have_posts()) { $posts->the_post(); $post_id = get_the_ID(); $post_title = get_the_title(); $post_url = get_permalink(); $post_format = get_post_format(); ?> <div class="item"> <?php if (has_post_thumbnail()) { $image_croped = KopaImage::get_post_image_src($post_id, 'size_07'); ?> <figure> <a href="<?php echo $post_url; ?> " class="pull-left"> <img src="<?php echo $image_croped; ?> " alt=""> <span><?php echo KopaIcon::getIconPostFormat($post_format); ?> </span> </a> </figure> <?php } ?> <div class="item-content"> <?php if (!$params['is_hide_title']) { ?> <h4 class="post-title"><a href="<?php echo $post_url; ?> "><?php echo $post_title; ?> </a></h4> <?php } ?> <?php if (!$params['is_hide_excerpt']) { if ((int) $params['excerpt_character_limit'] > 0) { $excerpt = KopaUtil::substr($post->post_content, (int) $params['excerpt_character_limit']); echo $excerpt ? sprintf('<p>%s</p>', $excerpt) : ''; } else { the_excerpt(); } } ?> </div> <ul class="kp-meta-post bottom list-inline"> <li class="metadata-first"><?php echo KopaIcon::getIconDatetime(); ?> <span><?php echo get_the_date(); ?> </span></li> <?php switch ($orderby) { case 'views': printf('<li>%s<span>%s</span></li>', KopaIcon::getIconView(), KopaUtil::get_views($post_id, true)); break; case 'likes': printf('<li>%s</li>', KopaUtil::kopa_get_like_button($post_id, true)); break; default: ?> <li><?php echo KopaIcon::getIconComment(); comments_popup_link(__('No Comment', kopa_get_domain()), __('1 Comment', kopa_get_domain()), __('% Comments', kopa_get_domain()), '', __('0 Comment', kopa_get_domain())); ?> </li> <?php break; } ?> </ul> </div> <?php } wp_reset_postdata(); }