public function add_event() { global $javo_tso; $javo_query = new javo_array($_POST); $args = array("post_title" => $_POST['txt_title'], "post_content" => $_POST['txt_content'], "post_author" => get_current_user_id(), "post_type" => "jv_events"); $edit = !empty($_POST['edit']) ? get_post($_POST['edit']) : false; if ($edit) { $args["ID"] = $edit->ID; } else { $args['post_status'] = 'publish'; } $post_id = $edit ? wp_update_post($args) : wp_insert_post($args); // Event Featured Image set_post_thumbnail($post_id, $javo_query->get('img_featured', '')); // Event Category wp_set_post_terms($post_id, $javo_query->get('sel_category', ''), "jv_events_category"); // if (false === ($expire = $javo_query->get('javo_event_expire', false))) { update_post_meta($post_id, 'event_expire_days', $expire); } update_post_meta($post_id, 'parent_post_id', $javo_query->get('txt_parent_post_id')); update_post_meta($post_id, 'brand', $javo_query->get('txt_brand')); if (!$edit) { do_action('javo_new_notifier_mail', $post_id, 'event'); } echo json_encode(array("result" => (int) $post_id > 0 ? true : false, "link" => get_permalink($post_id), "status" => $edit ? "edit" : "new", "post_id" => $post_id)); exit(0); }
public function create_css($args = NULL) { global $javo_tso; $wpdir = wp_upload_dir(); $wpdir = $wpdir['path']; $fn = $wpdir . "/style" . date("-Y-m-d-h-i-s") . ".css"; $fh = @fopen($fn, "w"); $args = new javo_array($args); ob_start(); ?> /* Themes settings css */ <?php printf("\r\n\tbody{\r\n\t\tfont-size:%dpx;\r\n\t\tline-height:%dpx;\r\n\t\tfont-family:%s;\r\n\t}\n", $args->get('basic_normal_size'), $args->get('basic_line_height'), $args->get('basic_font')); /** Color accent **/ printf(".accent{ background-color:%s;}\n", $args->get('accent_color') . " !important"); printf(".accent:hover{ background-color:%s; }\n", $args->get('accent_color') . " !important"); /* Panel Color setting*/ printf(".javo_somw_panel, .javo_somw_list_inner, .javo_somw_panel form button{ background-color:%s; }\n", $args->get('panel_bg_color') . " !important"); printf(".javo_somw_panel::-webkit-scrollbar-button:start:decrement, ::-webkit-scrollbar-button:end:increment, .javo_somw_panel::-webkit-scrollbar-track{ background:%s; }\n", $args->get('panel_bg_color') . " !important"); printf(".javo_somw_panel .newrow button, .javo_somw_panel form select, .javo_somw_panel form .newrow input, .javo_somw_panel .newrow .javo_somw_onoff{ background-color:%s; }\n", $args->get('panel_bt_color') . " !important"); printf(".javo_somw_panel .newrow button.active{ background-color:%s; border:1px %s solid; }\n", $args->get('panel_active_bt_color') . " !important", $args->get('panel_active_bt_color')); printf(".gmap .javo_somw_opener_type1{ background:%s; }\n", $args->get('panel_hide_bt_color') . " !important"); printf(".javo_somw_panel form button, .javo_somw_panel form select, .javo_somw_panel form select, .javo_somw_panel form .newrow input, .gmap .javo_somw_opener_type1{ color:%s; }\n", $args->get('panel_bt_text_color') . " !important"); printf(".javo_somw_panel form button.active, .gmap .javo_somw_opener_type1{ color:%s; }\n", $args->get('panel_bt_active_text_color') . " !important"); printf(".javo_somw_panel .newrow .title, .javo_somw_panel .newrow .javo_somw_list_title, .javo_somw_list a{ color:%s; }\n", $args->get('panel_title_color') . " !important"); printf(".javo_somw_panel .javo_somw_list_inner .meta-wrap .javo_somw_list{ color:%s; }\n", $args->get('panel_text_color') . " !important"); /*Map Size*/ printf(".gmap, .gmap .map_area{height:%spx !important;}\n", $args->get('map_size')); /** Header tag group **/ printf("h1{font:%spx/%spx '%s';}\n", $args->get('h1_normal_size'), $args->get('h1_line_height'), $args->get('h1_font')); printf("h2{font:%spx/%spx '%s';}\n", $args->get('h2_normal_size'), $args->get('h2_line_height'), $args->get('h2_font')); printf("h3{font:%spx/%spx '%s';}\n", $args->get('h3_normal_size'), $args->get('h3_line_height'), $args->get('h3_font')); printf("h4{font:%spx/%spx '%s';}\n", $args->get('h4_normal_size'), $args->get('h4_line_height'), $args->get('h4_font')); printf("h5{font:%spx/%spx '%s';}\n", $args->get('h5_normal_size'), $args->get('h5_line_height'), $args->get('h5_font')); printf("h6{font:%spx/%spx '%s';}\n", $args->get('h6_normal_size'), $args->get('h6_line_height'), $args->get('h6_font')); /** header **/ printf(".navbar {background:%s;}\n", $args->get('header_bg_color')); // navi background color printf(".navbar {height: %spx;}\n", $args->get('header_background_height')); // height printf(".nav>li>a {font:%spx/%spx '%s';}\n", $args->get('header_font_size'), $args->get('header_line_height'), $args->get('navi_font_family')); // font printf(".navbar-nav>li>a {line-height: %spx; color:%s;}\n", $args->get('header_line_height'), $args->get('header_layout_font_color')); // height printf(".navbar-nav>.active>a, .navbar-nav>.active>a:hover, .navbar-nav>.active>a:focus {color:%s;background:%s;}\n", $args->get('header_font_color_current'), $args->get('header_bg_color_current')); // top bar background color printf(".navbar-default .navbar-nav>.open>a, .navbar-default .navbar-nav>.open>a:hover, .navbar-default .navbar-nav>.open>a:focus {color:%s;background:%s; border-bottom:4px %s solid;}\n", $args->get('header_font_color_current'), $args->get('header_bg_color_current'), $args->get('header_bottom_color_current')); // top bar background color /** dropdown css **/ printf(".dropdown-menu {background:%s;}\n", $args->get('header_submenu_bg_color')); // background printf(".dropdown-menu > li > a{font:%spx/%spx '%s'; color:%s;}\n", $args->get('header_sub_font_size'), $args->get('header_sub_font_line_height'), $args->get('navi_font_family'), $args->get('header_submenu_font_color')); if ($args->get('panel_display') == 'hide') { printf("\r\n\t\t.javo_somw_panel{ display:none !important; }\r\n\t\t.javo_somw_opener_type1 {display:none;}\r\n\t\t.map_area {margin-left:0px !important;}\r\n\t"); } $content = ob_get_clean(); @fwrite($fh, $content); @fclose($fh); return $fn; }
public static function javo_post_meta_box_save($post_id) { if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return $post_id; } /* * Variables Initialize * *======================================================================================* */ $javo_query = new javo_ARRAY($_POST); $javo_itemlist_query = new javo_ARRAY($javo_query->get('javo_il', array())); if ($javo_query->get('javo_opt_header') != null) { update_post_meta($post_id, "javo_header_type", $javo_query->get('javo_opt_header')); } if ($javo_query->get('javo_opt_fancy') != null) { update_post_meta($post_id, "javo_header_fancy_type", $javo_query->get('javo_opt_fancy')); } if ($javo_query->get('javo_opt_sidebar') != null) { update_post_meta($post_id, "javo_sidebar_type", $javo_query->get('javo_opt_sidebar')); } if (false !== ($tmp = $javo_itemlist_query->get('type', false))) { update_post_meta($post_id, "javo_item_listing_type", $tmp); } if (false !== ($tmp = $javo_itemlist_query->get('list_position', false))) { update_post_meta($post_id, "javo_item_listing_position", $tmp); } if (false !== ($tmp = $javo_itemlist_query->get('content_position', false))) { update_post_meta($post_id, "javo_item_listing_content_position", $tmp); } if (false !== ($tmp = $javo_query->get('javo_hd', false))) { update_post_meta($post_id, "javo_hd_post", $tmp); } if (false !== ($tmp = $javo_query->get('javo_map_opts', false))) { update_post_meta($post_id, "javo_map_page_opt", $tmp); } // Slide AutoPlay if (false !== ($tmp = $javo_query->get('javo_detail_slide_autoplay', false))) { update_post_meta($post_id, "javo_detail_slide_autoplay", $tmp); } // Fancy options if ($javo_query->get('javo_fancy', null) != null) { update_post_meta($post_id, "javo_fancy_options", @serialize($javo_query->get('javo_fancy', null))); } if ($javo_query->get('javo_slide', null) != null) { update_post_meta($post_id, "javo_slider_options", @serialize($javo_query->get('javo_slide', null))); } $javo_controller_setup = !empty($_POST['javo_post_control']) ? @serialize($_POST['javo_post_control']) : ""; update_post_meta($post_id, "javo_control_options", $javo_controller_setup); /* * Set Page Template Default Values * *======================================================================================* */ update_post_meta($post_id, "javo_slider_type", $javo_query->get('javo_opt_slider')); update_post_meta($post_id, "javo_posts_per_page", $javo_query->get('javo_posts_per_page')); update_post_meta($post_id, "javo_item_tax", @serialize((array) $javo_query->get('javo_item_tax'))); update_post_meta($post_id, "javo_blog_tax", $javo_query->get('javo_blog_tax')); update_post_meta($post_id, "javo_item_terms", @serialize($javo_query->get('javo_item_terms', null))); update_post_meta($post_id, "javo_blog_terms", @serialize($javo_query->get('javo_blog_terms', null))); /* * Custom Post Types Meta Save * *======================================================================================* */ switch (get_post_type($post_id)) { case "item": $javo_item_query = new javo_ARRAY($javo_query->get('javo_item_attribute', array())); if ($javo_item_query->get('featured', null) != null) { update_post_meta($post_id, "javo_this_featured_item", $javo_item_query->get('featured', '')); } // item meta if (isset($_POST['javo_pt'])) { $ppt_meta = $_POST['javo_pt']; $javo_pt_query = new javo_array($ppt_meta); $ppt_images = !empty($_POST['javo_pt_detail']) ? $_POST['javo_pt_detail'] : null; $map_area_settings = !empty($ppt_meta['item_map_positon']) ? $ppt_meta['item_map_positon'] : array(); $map_area_settings = @serialize($map_area_settings); $map_type_settings = !empty($ppt_meta['item_map_type']) ? $ppt_meta['item_map_type'] : array(); $map_type_settings = @serialize($map_type_settings); // is Assign ? if ($javo_query->get('item_author') == 'other') { remove_action('save_post', array(__CLASS__, 'javo_post_meta_box_save')); $post_id = wp_update_post(array('ID' => $post_id, 'post_author' => $javo_query->get('item_author_id'))); add_action('save_post', array(__CLASS__, 'javo_post_meta_box_save')); } // Upload Video $javo_video_query = new javo_ARRAY($javo_query->get('javo_video', array())); $javo_video = null; if ($javo_video_query->get('portal', NULL) != NULL) { $protocal = is_ssl() ? "https" : "http"; switch ($javo_video_query->get('portal')) { case 'youtube': $javo_attachment_video = "{$protocal}://www.youtube-nocookie.com/embed/" . $javo_video_query->get('video_id', 0); break; case 'vimeo': $javo_attachment_video = "{$protocal}://player.vimeo.com/video/" . $javo_video_query->get('video_id', 0); break; case 'dailymotion': $javo_attachment_video = "{$protocal}://www.dailymotion.com/embed/video/" . $javo_video_query->get('video_id', 0); break; case 'yahoo': $javo_attachment_video = "{$protocal}://d.yimg.com/nl/vyc/site/player.html#vid=" . $javo_video_query->get('video_id', 0); break; case 'bliptv': $javo_attachment_video = "{$protocal}://a.blip.tv/scripts/shoggplayer.html#file=http://blip.tv/rss/flash/" . $javo_video_query->get('video_id', 0); break; case 'veoh': $javo_attachment_video = "{$protocal}://www.veoh.com/static/swf/veoh/SPL.swf?videoAutoPlay=0&permalinkId=" . $javo_video_query->get('video_id', 0); break; case 'viddler': $javo_attachment_video = "{$protocal}://www.viddler.com/simple/" . $javo_video_query->get('video_id', 0); break; } $javo_video = array('portal' => $javo_video_query->get('portal', null), 'video_id' => $javo_video_query->get('video_id', null), 'url' => $javo_attachment_video, 'html' => !empty($javo_attachment_video) ? sprintf('<iframe width="100%%" height="370" src="%s"></iframe>', $javo_attachment_video) : null, 'single_position' => $javo_video_query->get('single_position', null)); } // Default Meta if (false !== (bool) ($meta = $javo_pt_query->get('meta', false))) { foreach ($meta as $key => $value) { update_post_meta($post_id, $key, $value); } } // Default Meta if (false !== (bool) ($meta = $javo_pt_query->get('map', false))) { foreach ($meta as $key => $value) { update_post_meta($post_id, "jv_item_{$key}", $value); } } update_post_meta($post_id, "video", $javo_video); update_post_meta($post_id, "detail_images", @serialize($ppt_images)); update_post_meta($post_id, 'header_custom_frame', $javo_pt_query->get('header_frame', null)); update_post_meta($post_id, "item_map_positon", $map_area_settings); update_post_meta($post_id, "item_map_type", $map_type_settings); } break; case 'jv_events': $javo_event_query = new javo_ARRAY($javo_query->get('javo_event', array())); update_post_meta($post_id, "parent_post_id", $javo_event_query->get('parent_post_id', null)); update_post_meta($post_id, "brand", $javo_event_query->get('brand', null)); break; case 'review': $javo_event_query = new javo_ARRAY($javo_query->get('javo_event', array())); update_post_meta($post_id, "parent_post_id", $javo_event_query->get('parent_post_id', null)); update_post_meta($post_id, "brand", $javo_event_query->get('brand', null)); break; case 'jv_partners': $javo_partners_query = new javo_ARRAY($javo_query->get('javo_partners', array())); update_post_meta($post_id, 'javo_partner_website', $javo_partners_query->get('website', null)); break; } // End Switch }
public function javo_post_meta_box_save($post_id) { // In case of auto save if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return $post_id; } $javo_query = new javo_array($_POST); switch (get_post_type($post_id)) { case 'property': if (isset($_POST['javo_pt'])) { $ppt_meta = $_POST['javo_pt']; $latlng = array("lat" => $ppt_meta['lat'], "lng" => $ppt_meta['lng']); $ppt_images = !empty($_POST['javo_pt_detail']) ? $_POST['javo_pt_detail'] : null; $javo_pt_query = new javo_array($ppt_meta); update_post_meta($post_id, 'property_id', $javo_pt_query->get('property_id')); update_post_meta($post_id, 'bedrooms', $javo_pt_query->get('bedrooms')); update_post_meta($post_id, 'bathrooms', $javo_pt_query->get('bathrooms')); update_post_meta($post_id, 'parking', $javo_pt_query->get('parking')); update_post_meta($post_id, 'plot_size', $javo_pt_query->get('plot_size')); update_post_meta($post_id, 'living_rooms', $javo_pt_query->get('living_rooms')); update_post_meta($post_id, 'kitchens', $javo_pt_query->get('kitchens')); update_post_meta($post_id, 'rooms', $javo_pt_query->get('rooms')); update_post_meta($post_id, 'sale_price', $javo_pt_query->get('sale_price')); update_post_meta($post_id, 'price_postfix', $javo_pt_query->get('price_postfix')); update_post_meta($post_id, 'area', $javo_pt_query->get('area')); update_post_meta($post_id, 'area_postfix', $javo_pt_query->get('area_postfix')); update_post_meta($post_id, 'latlng', @serialize($latlng)); update_post_meta($post_id, 'detail_images', @serialize($ppt_images)); } break; } }
function javo_get_hmap_callback() { global $javo_tso, $javo_favorite, $javo_custom_item_tab; $javo_query = new javo_array($_POST); if ($javo_query->get('lang', null) != null) { global $sitepress; if (!empty($sitepress)) { $sitepress->switch_lang($javo_query->get('lang'), true); } } $javo_this_posts_args = array('post_status' => 'publish', 'post_type' => $javo_query->get('post_type', 'post'), 'posts_per_page' => $javo_query->get('ppp', 20), 'paged' => (int) $javo_query->get('current', 1), 'order' => $javo_query->get('order', 'DESC')); if ($javo_query->get('filter', null) != null) { if (is_Array($javo_query->get('filter'))) { foreach ($javo_query->get('filter') as $taxonomy => $terms) { if (!empty($terms)) { $javo_this_posts_args['tax_query']['relation'] = 'AND'; $javo_this_posts_args['tax_query'][] = array('taxonomy' => $taxonomy, 'field' => 'term_id', 'terms' => $terms); } } } } // End Filter if ($javo_query->get('keyword', null) != null) { $javo_this_posts_args['s'] = $javo_query->get('keyword'); } $javo_this_posts_markers = array(); $javo_this_posts = new WP_Query($javo_this_posts_args); ob_start(); ?> <div class="body-content"> <div class="col-md-12"> <div id="products" class="list-group"> <?php if ($javo_this_posts->have_posts()) { $i = 0; while ($javo_this_posts->have_posts()) { $javo_this_posts->the_post(); $javo_this_author_avatar_id = get_the_author_meta('avatar'); $javo_rating = new javo_RATING(get_the_ID()); ?> <div class="item col-md-6 col-xs-12"> <div class="thumbnail item-list-box-map"> <div class="thumb-wrap"> <?php if (has_post_thumbnail()) { the_post_thumbnail('javo-box-v', array('class' => 'group list-group-image item-thumbs')); } else { printf('<img src="%s" style="width:100%%; height:219px;">', $javo_tso->get('no_image', JAVO_IMG_DIR . '/no-image.png')); } ?> <div class="javo-left-overlay"> <div class="javo-txt-meta-area admin-color-setting"><?php echo javo_str_cut(javo_get_cat(get_the_ID(), 'item_category', __('No Category', 'javo_fr')), 20); ?> </div> <!-- javo-txt-meta-area --> <div class="corner-wrap"> <div class="corner"></div> <div class="corner-background"></div> </div> <!-- corner-wrap --> </div> <div class="rate-icons"> <?php if ($javo_custom_item_tab->get('ratings', '') == '') { ?> <div class="col-md-2"> <div class="col-md-12 javo-rating-registed-score" data-score="<?php echo $javo_rating->parent_rating_average; ?> "></div> </div> <?php } ?> </div> <!-- rate-icons --> <div class="intro"> <h2 class="group inner list-group-item-heading"><?php the_title(); ?> </h2> </div> <!-- intro --> <div class="location"> <?php echo wp_get_attachment_image($javo_this_author_avatar_id, 'javo-tiny', true, array('class' => 'img-circle', 'style' => 'width:50px; height:50px;')); ?> </div> <!-- location --> <div class="three-inner-button"> <a class="javo-hmap-marker-trigger three-inner-move" data-id="<?php echo 'mid_' . get_the_ID(); ?> " data-post-id="<?php the_ID(); ?> "><?php _e('Move', 'javo_fr'); ?> </a> <a href="<?php the_permalink(); ?> " class="three-inner-detail"><?php _e('Detail', 'javo_fr'); ?> </a> <a href="<?php the_permalink(); ?> " target="_brank" class="three-inner-popup"><?php _e('Popup', 'javo_fr'); ?> </a> </div><!-- three-inner-button --> </div> <!-- thumb-wrap --> <div class="caption"> <p class="group inner list-group-item-text"> </p> <!-- list-group-item-text --> <div class="row"> <div class="item-title-list"> <a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a> </div> <div class="group inner list-group-item-text item-excerpt-list"> <?php the_excerpt(); ?> </div> <!-- list-group-item-text --> <div class="col-xs-8 col-sm-8 col-md-8"> <div class="row"> <div class="col-md-12"> <?php echo strtoupper(javo_str_cut(javo_get_cat(get_the_ID(), 'item_location', __('No Location', 'javo_fr')), 22)); ?> </div><!-- col md 8 --> </div><!-- Row --> </div> <div class="col-xs-4 col-sm-4 col-md-4"> <div class="social-wrap pull-right"> <span class="javo-sns-wrap"> <i class="sns-facebook" data-title="<?php the_title(); ?> " data-url="<?php the_permalink(); ?> "> <a class="facebook"></a> </i> <i class="sns-twitter" data-title="<?php the_title(); ?> " data-url="<?php the_permalink(); ?> "> <a class="twitter"></a> </i> <i class="sns-heart"> <a class="favorite javo_favorite<?php echo $javo_favorite->on(get_the_ID(), ' saved'); ?> " data-post-id="<?php the_ID(); ?> "></a> </i> </span> </div> </div><!-- socail --> </div><!-- row--> </div><!-- Caption --> </div><!-- Thumbnail --> </div><!-- Col-md-4 --> <?php $javo_this_geolocation = @unserialize(get_post_meta(get_the_ID(), 'latlng', true)); $javo_set_icon = ''; $javo_marker_term_id = wp_get_post_terms(get_the_ID(), 'item_category'); if (!empty($javo_marker_term_id)) { $javo_set_icon = get_option('javo_item_category_' . $javo_marker_term_id[0]->term_id . '_marker', ''); if ($javo_set_icon == '') { $javo_set_icon = $javo_tso->get('map_marker', ''); } } $javo_this_posts_markers[get_the_ID()] = array('lat' => $javo_this_geolocation['lat'], 'lng' => $javo_this_geolocation['lng'], 'content' => apply_filters('javo_map_info_window_content', get_the_ID()), 'icon' => $javo_set_icon); } // End While } else { _e('Not Found Items', 'javo_fr'); } // End If printf('<div class="clearfix"></div>'); $big = 999999999; // need an unlikely integer $javo_this_pagination = paginate_links(array('base' => "%_%", 'format' => '?%#%', 'current' => (int) $javo_query->get('current', 1), 'prev_text' => __('< Prev', 'javo_fr'), 'next_text' => __('Next >', 'javo_fr'), 'total' => $javo_this_posts->max_num_pages, 'before_page_number' => '<span class="javo-hmap-pagination">', 'after_page_number' => '</span>')); printf('<div class="clearfix"></div><div class="javo-hmap-pagination-wrap">%s</div>', $javo_this_pagination); ?> </div><!-- /.col-md-12--> </div><!-- /#products --> </div><!-- /.body-content --> <div style="padding:200px 0;"> </div> <?php $javo_this_content_htmls = ob_get_clean(); wp_reset_query(); echo json_encode(array('html' => $javo_this_content_htmls, 'markers' => $javo_this_posts_markers)); exit; }
static function javo_map_callback() { // Get Theme Settings global $javo_tso, $javo_tso_map, $javo_favorite; // Get Parameter of Queries $javo_query = new javo_array($_POST); // Setup Agrumnets $javo_this_posts_args = array('post_status' => 'publish', 'post_type' => $javo_query->get('post_type', 'post'), 'posts_per_page' => $javo_query->get('ppp', 10), 'paged' => (int) $javo_query->get('current', 1), 'order' => $javo_query->get('order', 'DESC')); // WPML if ($javo_query->get('lang', null) != null) { global $sitepress; if (!empty($sitepress)) { $sitepress->switch_lang($javo_query->get('lang'), true); } } // Apply Filter if ($javo_query->get('filter', null) != null) { if (is_Array($javo_query->get('filter'))) { foreach ($javo_query->get('filter') as $taxonomy => $terms) { if (!empty($terms)) { $javo_this_posts_args['tax_query']['relation'] = 'AND'; $javo_this_posts_args['tax_query'][] = array('taxonomy' => $taxonomy, 'field' => 'term_id', 'terms' => $terms); } } } } // Set Keyword if ($javo_query->get('keyword', null) != null) { $javo_this_posts_args['s'] = $javo_query->get('keyword'); } switch ($javo_query->get('panel', 'list')) { case 'featured': $javo_this_posts_args['meta_query']['relation'] = 'AND'; $javo_this_posts_args['meta_query'][] = array('key' => 'javo_this_featured_item', 'compare' => '=', 'value' => 'use'); break; case 'favorite': $javo_this_posts_args = array('post_type' => $javo_query->get('post_type', 'post')); $javo_this_user_favorite = (array) get_user_meta(get_current_user_id(), 'favorites', true); $javo_this_user_favorite_posts = array('0'); if (!empty($javo_this_user_favorite)) { foreach ($javo_this_user_favorite as $favorite) { if (!empty($favorite['post_id'])) { $javo_this_user_favorite_posts[] = $favorite['post_id']; } } // End foreach } // End if $javo_this_posts_args['post__in'] = (array) $javo_this_user_favorite_posts; break; case 'list': default: } // Set Read More if ($javo_query->get('offset', null) != null) { $javo_this_posts_args['offset'] = $javo_query->get('offset'); } // Return Variables $javo_this_return = array(); // Queries Loop $javo_this_posts = new WP_Query($javo_this_posts_args); if ($javo_this_posts->have_posts()) { while ($javo_this_posts->have_posts()) { $javo_this_posts->the_post(); $javo_meta_query = new javo_get_meta(get_the_ID()); $javo_rating = new javo_RATING(get_the_ID()); $javo_latlng = @unserialize($javo_meta_query->_get('latlng', array())); $javo_latlng = new javo_ARRAY($javo_latlng); $javo_set_icon = ''; $javo_marker_term_id = wp_get_post_terms(get_the_ID(), 'item_category'); if (!empty($javo_marker_term_id)) { $javo_set_icon = get_option('javo_item_category_' . $javo_marker_term_id[0]->term_id . '_marker', ''); if ($javo_set_icon == '') { $javo_set_icon = $javo_tso->get('map_marker', ''); } } $javo_this_thumbnail = get_the_post_thumbnail(get_the_ID(), array(50, 50)); $javo_this_thumbnail = $javo_this_thumbnail != '' ? $javo_this_thumbnail : sprintf('<img src="%s" class="img-responsive wp-post-image" style="width:50px; height:50px;">', $javo_tso->get('no_image', JAVO_IMG_DIR . '/no-image.png')); $javo_this_thumbnail_large = get_the_post_thumbnail(get_the_ID(), 'javo-box-v', array('class' => 'group list-group-image item-thumbs')); $javo_this_thumbnail_large = $javo_this_thumbnail_large != '' ? $javo_this_thumbnail_large : sprintf('<img src="%s" style="width:100%%; height:219px;">', $javo_tso->get('no_image', JAVO_IMG_DIR . '/no-image.png')); $javo_this_author_avatar_id = get_the_author_meta('avatar'); $javo_this_author_avatar = wp_get_attachment_image($javo_this_author_avatar_id, 'javo-tiny', true, array('class' => 'img-circle', 'style' => 'width:50px; height:50px;')); $javo_this_return[get_the_ID()] = array('post_title' => get_the_title(), 'contents' => javo_str_cut(strip_shortcodes(get_the_excerpt()), 300), 'thumbnail' => $javo_this_thumbnail, 'thumbnail_large' => $javo_this_thumbnail_large, 'avatar' => $javo_this_author_avatar, 'author_name' => get_the_author_meta('display_name'), 'permalink' => get_permalink(), 'category' => $javo_meta_query->cat('item_category', __('No Category', 'javo_fr')), 'location' => $javo_meta_query->cat('item_location', __('No Location', 'javo_fr')), 'favorite' => $javo_favorite->on(get_the_ID(), ' saved'), 'lat' => $javo_latlng->get('lat'), 'lng' => $javo_latlng->get('lng'), 'icon' => $javo_set_icon, 'phone' => $javo_meta_query->get('phone'), 'mobile' => $javo_meta_query->get('mobile'), 'website' => $javo_meta_query->get('website'), 'email' => $javo_meta_query->get('email'), 'address' => $javo_meta_query->get('address'), 'rating' => $javo_rating->parent_rating_average, 'rating_count' => $javo_meta_query->get_child_count('ratings'), 'review_count' => $javo_meta_query->get_child_count('review')); } } wp_reset_query(); $javo_this_pagination = ''; if ($javo_query->get('pagination') == 'read_more') { $javo_this_pagination = sprintf('<a class="btn btn-primary btn-block javo-wide-map-read-more">%s</a>', __('Read More', 'javo_fr')); } else { $javo_this_pagination = sprintf('<div class="javo_pagination">%s</div>', paginate_links(array('base' => "%_%", 'format' => '?%#%', 'current' => (int) $javo_query->get('current', 1), 'total' => $javo_this_posts->max_num_pages))); } echo json_encode(array('state' => 'success', 'result' => $javo_this_return, 'pagination' => $javo_this_pagination)); exit; }
public function time_line_ajax() { $javo_query = new javo_array($_POST); $javo_ajax_timeline_args = array('post_type' => 'post', 'post_status' => 'publish', 'offset' => (int) $javo_query->get('offset'), 'posts_per_page' => (int) $javo_query->get('count')); $javo_item_timeline = new wp_query($javo_ajax_timeline_args); ob_start(); if ($javo_item_timeline->have_posts()) { $i = 0; while ($javo_item_timeline->have_posts()) { $i++; $javo_item_timeline->the_post(); switch ($i % 5) { case 0: $javo_badge = "warning"; break; case 1: $javo_badge = "danger"; break; case 2: $javo_badge = "primary"; break; case 3: $javo_badge = "info"; break; case 4: $javo_badge = "success"; break; default: $javo_badge = ""; } ?> <li<?php echo $i % 2 == 0 ? ' class="jv_timeline-inverted"' : ''; ?> > <div class="jv_timeline-badge <?php echo $javo_badge; ?> "><i class="glyphicon glyphicon-check"></i></div> <div class="jv_timeline-panel"> <div class="jv_timeline-heading"> <h4 class="jv_timeline-title"><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a></h4> <p><small class="text-muted"><i class="glyphicon glyphicon-time"></i> <?php echo get_the_date(); ?> </small></p> </div> <div class="jv_timeline-body"> <div class="row"> <a href="<?php the_permalink(); ?> "> <div class="col-md-6"> <?php if (has_post_thumbnail()) { the_post_thumbnail('medium'); } ?> </div> <div class="col-md-6"> <?php echo javo_str_cut(get_the_content(), 150); ?> </div> </a> </div><!-- Close Row --> </div><!-- Timeline Body--> </div> </li> <?php } // End While } // End If $javo_timeline_content = ob_get_clean(); wp_reset_query(); echo json_encode(array('result' => 'hi', 'content' => $javo_timeline_content)); exit; }