function projectTheme_release_milestone_link($id) { $opt = get_option('ProjectTheme_my_account_milestones_id'); $perm = ProjectTheme_using_permalinks(); if ($perm == true) { return get_permalink($opt) . "?release_id=" . $id; } else { return get_permalink($opt) . "&release_id=" . $id; } }
wp_publish_post($pid); $xx = current_time('timestamp', 0); $post_pr_new_date = date('Y-m-d H:i:s', $xx); $gmt = get_gmt_from_date($xx); $post_pr_info = array("ID" => $pid, "post_date" => $post_pr_new_date, "post_date_gmt" => $gmt, "post_status" => "publish"); wp_update_post($post_pr_info); ProjectTheme_send_email_posted_project_approved($pid); ProjectTheme_send_email_posted_project_approved_admin($pid); } else { ProjectTheme_send_email_posted_project_not_approved($pid); ProjectTheme_send_email_posted_project_not_approved_admin($pid); ProjectTheme_send_email_subscription($pid); } update_post_meta($pid, "paid_listing_date_paypal" . $datemade, current_time('timestamp', 0)); } } if (get_option('projectTheme_admin_approves_each_project') == 'yes') { if (ProjectTheme_using_permalinks()) { wp_redirect(get_permalink(get_option('ProjectTheme_my_account_page_id')) . "?prj_not_approved=" . $pid); } else { wp_redirect(get_permalink(get_option('ProjectTheme_my_account_page_id')) . "&prj_not_approved=" . $pid); } } else { wp_redirect(get_permalink($pid)); } break; case 'cancel': // Order was canceled... wp_redirect(get_bloginfo('siteurl')); break; }
$wpdb->query($query); $bid_posted = 1; } else { $query = "insert into " . $wpdb->prefix . "project_bids (days_done,bid,description, uid, pid, date_made) \r\n\t\t\t\t\tvalues('{$days_done}','{$bid}','{$des}','{$uid}','{$pid}','{$tm}')"; $wpdb->query($query); $bid_posted = 1; add_post_meta($pid, 'bid', $uid); } // endif has bid already } } if ($bid_posted == 1) { ProjectTheme_send_email_when_bid_project_owner($pid, $uid, $bid); ProjectTheme_send_email_when_bid_project_bidder($pid, $uid, $bid); //--------------------- $prm = ProjectTheme_using_permalinks(); if ($prm == true) { wp_redirect(get_permalink(get_the_ID()) . "/?bid_posted=1"); } else { wp_redirect(get_permalink(get_the_ID()) . "&bid_posted=1"); } exit; } //endif bid posted } else { $pid = base64_decode($_POST['control_id']); wp_redirect(get_bloginfo('siteurl') . "/wp-login.php"); $_SESSION['redirect_me_back'] = get_permalink($pid); exit; } }
function projectTheme_template_redirect() { global $wp; global $wp_query, $post, $wp_rewrite; if (isset($_GET['_ad_delete_pid'])) { if (is_user_logged_in()) { $pid = $_GET['_ad_delete_pid']; $pstpst = get_post($pid); global $current_user; get_currentuserinfo(); if ($pstpst->post_author == $current_user->ID or current_user_can('manage_options')) { wp_delete_post($_GET['_ad_delete_pid']); echo "done"; } } exit; } if (isset($_GET['my_upload_of_project_files'])) { get_template_part('lib/upload_main/uploady2'); die; } if (isset($_GET['my_upload_of_project_files_proj'])) { get_template_part('lib/upload_main/uploady5'); die; } if (isset($_GET['my_upload_of_project_files2'])) { get_template_part('lib/upload_main/uploady'); die; } if (isset($_GET['alert_ipn'])) { projectTheme_alert_pay_IPN(); die; } if (isset($_GET['my_upload_of_project_files8'])) { get_template_part('lib/upload_main/uploady8'); die; } if (isset($_GET['complete_paypal_escrow'])) { get_template_part('lib/gateways/complete_paypal_escrow'); die; } if (isset($_GET['get_subcats_for_me'])) { $cat_id = $_POST['queryString']; if (empty($cat_id)) { echo " "; } else { $args2 = "orderby=name&order=ASC&hide_empty=0&parent=" . $cat_id; $sub_terms2 = get_terms('project_cat', $args2); if (count($sub_terms2) > 0) { $ret = '<select class="do_input_new" name="subcat">'; $ret .= '<option value="">' . __('Select Subcategory', 'ProjectTheme') . '</option>'; foreach ($sub_terms2 as $sub_term2) { $sub_id2 = $sub_term2->term_id; $ret .= '<option ' . ($selected == $sub_id2 ? "selected='selected'" : " ") . ' value="' . $sub_id2 . '">' . $sub_term2->name . '</option>'; } $ret .= "</select>"; echo $ret; } } die; } if (isset($_GET['get_locscats_for_me'])) { $cat_id = $_POST['queryString']; if (empty($cat_id)) { echo " "; } else { $args2 = "orderby=name&order=ASC&hide_empty=0&parent=" . $cat_id; $sub_terms2 = get_terms('project_location', $args2); if (count($sub_terms2) > 0) { $ret = '<select class="do_input_new" name="subloc" onchange="display_subcat3(this.value)">'; $ret .= '<option value="">' . __('Select Sublocation', 'ProjectTheme') . '</option>'; foreach ($sub_terms2 as $sub_term2) { $sub_id2 = $sub_term2->term_id; $ret .= '<option ' . ($selected == $sub_id2 ? "selected='selected'" : " ") . ' value="' . $sub_id2 . '">' . $sub_term2->name . '</option>'; } $ret .= "</select>"; echo $ret; } } die; } if (isset($_GET['set_image_for_term'])) { if (is_user_logged_in()) { $term_id = $_GET['term_id']; $attachment_id = $_GET['attachment_id']; update_post_meta($attachment_id, 'category_image', $term_id); } die; } //--------------------------- if (isset($_GET['get_locscats_for_me2'])) { $cat_id = $_POST['queryString']; if (empty($cat_id)) { echo " "; } else { $args2 = "orderby=name&order=ASC&hide_empty=0&parent=" . $cat_id; $sub_terms2 = get_terms('project_location', $args2); if (count($sub_terms2) > 0) { $ret = '<select class="do_input_new" name="subloc2" >'; $ret .= '<option value="">' . __('Select Sublocation', 'ProjectTheme') . '</option>'; foreach ($sub_terms2 as $sub_term2) { $sub_id2 = $sub_term2->term_id; $ret .= '<option ' . ($selected == $sub_id2 ? "selected='selected'" : " ") . ' value="' . $sub_id2 . '">' . $sub_term2->name . '</option>'; } $ret .= "</select>"; echo $ret; } } die; } //--------------------------------------------------- if (isset($_GET['redirect_search'])) { if ($_POST['redirect_search'] == "freelancers") { $_SESSION['tt_ss'] = 'freelancers'; $string = "username="******"?" . $string); } else { wp_redirect($ProjectTheme_provider_search_page_id . "&" . $string); } } else { $_SESSION['tt_ss'] = 'projects'; $string = "term=" . urlencode($_POST['input_text_serch']); $ProjectTheme_advanced_search_page_id = get_permalink(get_option('ProjectTheme_advanced_search_page_id')); $perm = ProjectTheme_using_permalinks(); if ($perm == true) { wp_redirect($ProjectTheme_advanced_search_page_id . "?" . $string); } else { wp_redirect($ProjectTheme_advanced_search_page_id . "&" . $string); } } exit; } if (isset($_GET['get_my_project_vl_thing'])) { $pids = $_POST['queryString']; if ($pids == 0) { echo 0; die; } $ar = 1; $bids = Bid::get_by_pid_uid($pids, $uid = '', $single = false, $filters = array("winner='1'", "paid='0'", "outstanding='0'", "delivered='1'")); echo '<select name="uids" onchange="on_winner_sel();" required="">'; foreach ($bids as $key => $bid) { $escrow = Escrow::get_by_field('bid', $bid->id); if (!isset($escrow)) { $user = get_userdata($bid->uid); echo '<option value="' . $bid->uid . '" bid="' . $bid->id . '">' . $user->user_login . '</option>'; } } echo "</select>"; //echo $bid->bid; die; } $my_pid = $post->ID; $parent = $post->post_parent; $paagee = $wp_query->query_vars['my_custom_page_type']; $p_action = $wp_query->query_vars['p_action']; $ProjectTheme_my_account_page_id = get_option('ProjectTheme_my_account_page_id'); $ProjectTheme_post_new_page_id = get_option('ProjectTheme_post_new_page_id'); $ProjectTheme_my_account_page_id = get_option('ProjectTheme_my_account_page_id'); //------------- if (isset($_GET['redir1'])) { $_SESSION['redir1'] = $_GET['redir1']; } if (($parent == $ProjectTheme_my_account_page_id or $my_pid == get_option('ProjectTheme_my_account_milestones_id')) and !empty($my_pid)) { if (!is_user_logged_in()) { wp_redirect(ProjectTheme_login_url()); exit; } } //------------- $ProjectTheme_enable_2_user_tp = get_option('ProjectTheme_enable_2_user_tp'); if ($ProjectTheme_enable_2_user_tp == "yes" && $p_action != 'choose_user_tp') { if (is_user_logged_in()) { global $current_user; get_currentuserinfo(); $user_tp = get_user_meta($current_user->ID, 'user_tp', true); if (empty($user_tp) && !current_user_can('level_10')) { wp_redirect(get_bloginfo('siteurl') . "/?p_action=choose_user_tp"); exit; } } } if ($p_action == "payza_listing") { get_template_part('lib/gateways/payza_listing'); die; } if (isset($_GET['notify_chained'])) { if ($_POST['status'] == "INCOMPLETE") { $trID = $_POST['tracking_id']; $trID = explode("_", $trID); $pid = $trID[0]; update_post_meta($pid, 'outstanding', "1"); //update_post_meta($pid, 'paid_user',"1"); //update_post_meta($pid, "paid_user_date", current_time('timestamp',0)); update_post_meta($pid, "adaptive_done", "started"); $projectTheme_get_winner_bid = projectTheme_get_winner_bid($pid); ProjectTheme_send_email_on_escrow_project_to_bidder($pid, $projectTheme_get_winner_bid->uid, $_POST['amount']); ProjectTheme_send_email_on_escrow_project_to_owner($pid, $_POST['amount']); //$projectTheme_get_winner_bid = projectTheme_get_winner_bid($pid); //ProjectTheme_send_email_when_on_completed_project($pid, $projectTheme_get_winner_bid->uid, $projectTheme_get_winner_bid->bid); } } if (isset($_GET['return_chained'])) { $ret_id = $_GET['return_chained']; $pid_d = get_option('adaptive_payment_ID_thing_' . $ret_id); wp_redirect(get_permalink(get_option('ProjectTheme_my_account_awaiting_completion_id'))); exit; } //------------ if ($my_pid == $ProjectTheme_post_new_page_id) { if (!is_user_logged_in()) { wp_redirect(ProjectTheme_login_url() . '?redirect_to=' . urlencode(get_permalink($ProjectTheme_post_new_page_id))); exit; } global $current_user; get_currentuserinfo(); if (!ProjectTheme_is_user_business($current_user->ID)) { wp_redirect(get_bloginfo('siteurl') . '?contr_error=1'); /*wp_redirect(get_bloginfo('siteurl'));*/ exit; } if (!isset($_GET['projectid'])) { $set_ad = 1; } else { $set_ad = 0; } if (!empty($_GET['projectid'])) { $my_main_post = get_post($_GET['projectid']); if ($my_main_post->post_author != $current_user->ID) { wp_redirect(get_bloginfo('siteurl')); exit; } } if ($set_ad == 1) { $pid = ProjectTheme_get_auto_draft($current_user->ID); wp_redirect(ProjectTheme_post_new_with_pid_stuff_thg($pid)); } get_template_part('lib/post_new_post'); } //------------- if ($my_pid == $ProjectTheme_my_account_page_id) { if (!is_user_logged_in()) { wp_redirect(ProjectTheme_login_url()); exit; } } //---------------------------------------------------- if ($p_action == "choose_user_tp") { get_template_part('lib/choose_user_tp'); die; } if (isset($_GET['autosuggest'])) { get_template_part('autosuggest'); } if ($p_action == "mark_delivered") { get_template_part('lib/my_account/mark_delivered'); die; } if ($p_action == "work_timer") { get_template_part('lib/my_account/work_timer'); die; } if ($p_action == "mark_completed") { get_template_part('lib/my_account/mark_completed'); die; } if ($p_action == "mark_in_progress") { get_template_part('lib/my_account/mark_in_progress'); die; } if ($p_action == "credits_listing") { get_template_part('lib/gateways/credits_listing'); die; } if ($p_action == "relist_this_done") { get_template_part('lib/my_account/relist_this_done'); die; } if ($p_action == "mb_listing_response") { get_template_part('lib/gateways/moneybookers_listing_response'); die; } if ($p_action == "mb_listing") { get_template_part('lib/gateways/moneybookers_listing'); die; } if ($p_action == "paypal_listing") { get_template_part('lib/gateways/paypal_listing'); die; } if ($p_action == "pay_for_project_paypal") { get_template_part('lib/gateways/pay_for_project_paypal'); die; } if ($p_action == "edit_project") { get_template_part('lib/my_account/edit_project'); die; } if ($p_action == "rate_user") { get_template_part('lib/my_account/rate_user'); die; } if ($p_action == "choose_winner") { get_template_part('lib/choose_winner'); die; } if ($p_action == "group_winner") { get_template_part('lib/group_winner'); die; } if ($p_action == "remove_provider") { get_template_part('lib/remove_provider'); die; } if ($p_action == "user_profile") { get_template_part('lib/user-profile'); die; } if ($p_action == "user_feedback") { get_template_part('lib/user-feedback'); die; } if ($p_action == "delete_project") { get_template_part('lib/my_account/delete_project'); die; } if ($p_action == "close_project") { get_template_part('lib/my_account/close_project'); die; } if ($p_action == "repost_project") { get_template_part('lib/my_account/repost_project'); die; } if ($p_action == "paypal_deposit_pay") { get_template_part('lib/gateways/paypal_deposit_pay'); die; } if ($p_action == "payza_deposit_pay") { get_template_part('lib/gateways/payza_deposit_pay'); die; } if ($p_action == "mb_deposit_response") { get_template_part('lib/gateways/mb_deposit_response'); die; } if ($p_action == "mb_deposit_pay") { get_template_part('lib/gateways/mb_deposit_pay'); die; } if ($paagee == "pay_projects_by_credits") { get_template_part('lib/pay-projects-by-credits'); die; } if ($paagee == "show-all-categories") { get_template_part('lib/show-all-categories'); die; } if ($paagee == "show-all-locations") { get_template_part('lib/show-all-locations'); die; } if ($paagee == "post-new") { get_template_part('post-new'); die; } if ($paagee == "pay_paypal") { get_template_part('lib/gateways/paypal'); die; } if ($paagee == "advanced_search") { get_template_part('lib/advanced-search'); die; } if ($paagee == "alert-pay-return") { get_template_part('lib/gateways/alert-pay-return'); die; } if (isset($_GET['get_files_panel'])) { get_template_part('lib/get_files_panel'); die; } if (isset($_GET['get_bidding_panel'])) { get_template_part('lib/bidding-panel'); die; } if (isset($_GET['get_message_board'])) { get_template_part('lib/message-board'); die; } if ($paagee == "all-blog-posts") { get_template_part('lib/blog'); die; } if ($paagee == "all_featured_projects") { get_template_part('lib/all_featured_projects'); die; } if ($paagee == "user_feedback") { get_template_part('lib/user-feedback'); die; } if ($paagee == "buy_now") { get_template_part('lib/buy-now'); die; } if ($paagee == "pay-for-project") { get_template_part('lib/gateways/paypal-project'); die; } if ($paagee == "deposit_pay") { get_template_part('lib/gateways/deposit-pay'); die; } }
function ProjectTheme_advanced_search_area_main_function() { if (isset($_GET['pj'])) { $pj = $_GET['pj']; } else { $pj = 1; } if (isset($_GET['order'])) { $order = $_GET['order']; } else { $order = "DESC"; } if (isset($_GET['orderby'])) { $orderby = $_GET['orderby']; } else { $orderby = "date"; } if (isset($_GET['meta_key'])) { $meta_key = $_GET['meta_key']; } else { $meta_key = ""; } if (!empty($_GET['budgets'])) { $price_q = array('key' => 'budgets', 'value' => $_GET['budgets'], 'compare' => '='); } if (isset($_GET['featured'])) { $featured = array('key' => 'featured', 'value' => "1", 'compare' => '='); } $closed = array('key' => 'closed', 'value' => "0", 'compare' => '='); if (!empty($_GET['project_location_cat'])) { $loc = array('taxonomy' => 'project_location', 'field' => 'slug', 'terms' => $_GET['project_location_cat']); } else { $loc = ''; } if (!empty($_GET['project_cat_cat'])) { $adsads = array('taxonomy' => 'project_cat', 'field' => 'slug', 'terms' => $_GET['project_cat_cat']); } else { $adsads = ''; } //------------ global $term; $term = trim($_GET['term']); if (isset($_GET['term'])) { add_filter('posts_where', 'projectTheme_posts_where2'); } do_action('ProjectTheme_adv_search_before_search'); add_filter('posts_join', 'projectTheme_posts_join2'); add_filter('posts_orderby', 'projectTheme_posts_orderby'); //------------ //orderby price - meta_value_num $nrpostsPage = 10; $nrpostsPage = apply_filters('ProjectTheme_advanced_search_posts_per_page', $nrpostsPage); $args = array('posts_per_page' => $nrpostsPage, 'paged' => $pj, 'post_type' => 'project', 'order' => $order, 'meta_query' => array($price_q, $closed, $featured), 'meta_key' => $meta_key, 'orderby' => $orderby, 'tax_query' => array($loc, $adsads)); $the_query = new WP_Query($args); $nrposts = $the_query->found_posts; $totalPages = ceil($nrposts / $nrpostsPage); $pagess = $totalPages; //===============*********======================= ?> <div id="content" > <?php // The Loop if ($the_query->have_posts()) { while ($the_query->have_posts()) { $the_query->the_post(); projectTheme_get_post($post, $i); } if (isset($_GET['pj'])) { $pj = $_GET['pj']; } else { $pj = 1; } $pjsk = $pj; ?> <div class="div_class_div"> <?php $my_page = $pj; $page = $pj; $batch = 10; $nrpostsPage = $nrRes; $end = $batch * $nrpostsPage; if ($end > $pagess) { $end = $pagess; } $start = $end - $nrpostsPage + 1; if ($start < 1) { $start = 1; } $links = ''; $raport = ceil($my_page / $batch) - 1; if ($raport < 0) { $raport = 0; } $start = $raport * $batch + 1; $end = $start + $batch - 1; $end_me = $end + 1; $start_me = $start - 1; if ($end > $totalPages) { $end = $totalPages; } if ($end_me > $totalPages) { $end_me = $totalPages; } if ($start_me <= 0) { $start_me = 1; } $previous_pg = $page - 1; if ($previous_pg <= 0) { $previous_pg = 1; } $next_pg = $pages_curent + 1; if ($next_pg > $totalPages) { $next_pg = 1; } if ($my_page > 1) { echo '<a class="bighi" href="' . projectTheme_advanced_search_link_pgs($previous_pg) . '">' . __("<< Previous", "ProjectTheme") . '</a>'; echo '<a class="bighi" href="' . projectTheme_advanced_search_link_pgs($start_me) . '"><<</a>'; } for ($i = $start; $i <= $end; $i++) { if ($i == $pj) { echo '<a class="bighi" id="activees" href="#">' . $i . '</a>'; } else { echo '<a class="bighi" href="' . projectTheme_advanced_search_link_pgs($i) . '">' . $i . '</a>'; } } $next_pg = $pjsk + 1; if ($totalPages > $my_page) { echo '<a class="bighi" href="' . projectTheme_advanced_search_link_pgs($end_me) . '">>></a>'; } if ($page < $totalPages) { echo '<a class="bighi" href="' . projectTheme_advanced_search_link_pgs($next_pg) . '">' . __("Next >>", "ProjectTheme") . '</a>'; } ?> </div> <?php } else { echo '<div class="my_box3"> <div class="box_content"> '; echo __('No projects posted.', "ProjectTheme"); echo '</div></div>'; } // Reset Post Data wp_reset_postdata(); ?> </div> <div id="right-sidebar"> <li class=""> <h3 class="widget-title"><?php _e('Filter Options', 'ProjectTheme'); ?> </h3> <form method="get"> <table> <tr> <td><?php _e('Keyword', "ProjectTheme"); ?> :</td> <td><input size="20" class="" value="<?php echo $_GET['term']; ?> " name="term" /></td> </tr> <tr> <td><?php _e('Price', "ProjectTheme"); ?> :</td> <td><?php echo ProjecTheme_get_budgets_dropdown($_GET['budgets'], 'budgets_advanced_search', 1); ?> </td> </tr> <tr> <td><?php _e('Location', "ProjectTheme"); ?> :</td> <td><?php echo ProjectTheme_get_categories_slug("project_location", $_GET['project_location_cat'], __("Select Location", "ProjectTheme"), 'categ_advanced_search'); ?> </td> </tr> <tr> <td><?php _e('Category', "ProjectTheme"); ?> :</td> <td><?php echo ProjectTheme_get_categories_slug("project_cat", $_GET['project_cat_cat'], __("Select Category", "ProjectTheme"), 'categ_advanced_search'); ?> </td> </tr> <tr> <td><?php _e('Featured?', "ProjectTheme"); ?> :</td> <td><input type="checkbox" name="featured" value="1" <?php if (isset($_GET['featured'])) { echo 'checked="checked"'; } ?> /></td> </tr> <?php do_action('ProjectTheme_adv_search_add_to_form'); ?> <tr> <td></td> <td><input type="submit" value="<?php _e("Refine Search", "ProjectTheme"); ?> " name="ref-search" class="big-search-submit2" /></td> </tr> </table> </form> <div class="clear10"></div> <div style="float:left;width:100%"> <?php $ge = 'order=' . ($_GET['order'] == 'ASC' ? "DESC" : "ASC") . '&meta_key=budgets&orderby=meta_value_num'; foreach ($_GET as $key => $value) { if ($key != 'meta_key' && $key != 'orderby' && $key != 'order') { $ge .= '&' . $key . "=" . $value; } } //------------------------ $ge2 = 'order=' . ($_GET['order'] == 'ASC' ? "DESC" : "ASC") . '&orderby=title'; foreach ($_GET as $key => $value) { if ($key != 'orderby' && $key != 'order') { $ge2 .= '&' . $key . "=" . $value; } } //------------------------ $ge3 = 'order=' . ($_GET['order'] == 'ASC' ? "DESC" : "ASC") . '&meta_key=views&orderby=meta_value_num'; foreach ($_GET as $key => $value) { if ($key != 'meta_key' && $key != 'orderby' && $key != 'order') { $ge3 .= '&' . $key . "=" . $value; } } ?> <?php _e("Order by:", "ProjectTheme"); $ProjectTheme_advanced_search_page_id = get_option('ProjectTheme_advanced_search_page_id'); if (ProjectTheme_using_permalinks()) { $adv = get_permalink($ProjectTheme_advanced_search_page_id) . "?"; } else { $adv = get_permalink($ProjectTheme_advanced_search_page_id) . "&"; } ?> <a href="<?php echo $adv; echo $ge; ?> "><?php _e("Price", "ProjectTheme"); ?> </a> | <a href="<?php echo $adv; echo $ge2; ?> "><?php _e("Name", "ProjectTheme"); ?> </a> | <a href="<?php echo $adv; echo $ge2; ?> "><?php _e("Visits", "ProjectTheme"); ?> </a> </div> </li> <?php dynamic_sidebar('other-page-area'); ?> </div> <?php }
function ProjectTheme_post_new_with_pid_stuff_thg($pid, $step = 1, $fin = 'no') { $using_perm = ProjectTheme_using_permalinks(); if ($using_perm) { return get_permalink(get_option('ProjectTheme_post_new_page_id')) . "?post_new_step=" . $step . "&" . ($fin != "no" ? 'finalize=1&' : '') . "projectid=" . $pid; } else { return get_bloginfo('siteurl') . "/?page_id=" . get_option('ProjectTheme_post_new_page_id') . "&" . ($fin != "no" ? 'finalize=1&' : '') . "post_new_step=" . $step . "&projectid=" . $pid; } }
function ProjectTheme_advanced_search_area_main_function() { if (isset($_GET['pj'])) { $pj = $_GET['pj']; } else { $pj = 1; } if (isset($_GET['order'])) { $order = $_GET['order']; } else { $order = "DESC"; } if (isset($_GET['orderby'])) { $orderby = $_GET['orderby']; } else { $orderby = "date"; } if (isset($_GET['meta_key'])) { $meta_key = $_GET['meta_key']; } else { $meta_key = ""; } if (!empty($_GET['budgets'])) { $price_q = array('key' => 'budgets', 'value' => $_GET['budgets'], 'compare' => '='); } if (isset($_GET['featured'])) { $featured = array('key' => 'featured', 'value' => "1", 'compare' => '='); } $closed = array('key' => 'closed', 'value' => "0", 'compare' => '='); /* * Date filter */ if (!empty($_GET['time-posted-from']) && !empty($_GET['time-posted-to'])) { $time_posted = array('relation' => 'AND', array('key' => 'made_me_date', 'value' => strtotime($_GET['time-posted-from']), 'compare' => '>='), array('key' => 'made_me_date', 'value' => strtotime($_GET['time-posted-to']), 'compare' => '<=')); } elseif (!empty($_GET['time-posted-from'])) { $time_posted = array('key' => 'made_me_date', 'value' => strtotime($_GET['time-posted-from']), 'compare' => '>='); } elseif (!empty($_GET['time-posted-to'])) { $time_posted = array('key' => 'made_me_date', 'value' => strtotime($_GET['time-posted-to']), 'compare' => '<='); } /* * Visits filter */ if (!empty($_GET['visits-over'])) { $featured = array('key' => 'views', 'value' => $_GET['visits-over'], 'type' => 'numeric', 'compare' => '>='); } if (!empty($_GET['project_location_cat'])) { $loc = array('taxonomy' => 'project_location', 'field' => 'slug', 'terms' => $_GET['project_location_cat']); } else { $loc = ''; } if (!empty($_GET['project_cat_cat'])) { $adsads = array('taxonomy' => 'project_cat', 'field' => 'slug', 'terms' => $_GET['project_cat_cat']); } else { $adsads = ''; } //------------ global $term; /*$term = trim($_GET['term']); $tag_slug__in = explode(" ",$term);*/ if (!empty($_GET['term'])) { add_filter('posts_where', 'projectTheme_posts_where2'); } do_action('ProjectTheme_adv_search_before_search'); add_filter('posts_join', 'projectTheme_posts_join2'); add_filter('posts_orderby', 'projectTheme_posts_orderby'); //------------ //orderby price - meta_value_num $nrpostsPage = 10; $nrpostsPage = apply_filters('ProjectTheme_advanced_search_posts_per_page', $nrpostsPage); $args = array('posts_per_page' => $nrpostsPage, 'paged' => $pj, 'post_type' => 'project', 'order' => $order, 'meta_query' => array($price_q, $closed, $featured, $time_posted), 'meta_key' => $meta_key, 'orderby' => $orderby, 'tax_query' => array($loc, $adsads)); //var_dump($args); $the_query = new WP_Query($args); //var_dump($the_query); /*if(!$the_query->have_posts()){ remove_filter( 'posts_where' , 'projectTheme_posts_where2' ); $args = array( 'posts_per_page' => $nrpostsPage, 'paged' => $pj, 'post_type' => 'project', 'order' => $order , 'tag_slug__in'=>$tag_slug__in, 'meta_query' => array($price_q, $closed, $featured) ,'meta_key' => $meta_key, 'orderby'=>$orderby,'tax_query' => array($loc, $adsads)); $the_query = new WP_Query( $args ); } var_dump($the_query);*/ $nrposts = $the_query->found_posts; $totalPages = ceil($nrposts / $nrpostsPage); $pagess = $totalPages; //===============*********======================= ?> <div id="content" > <?php echo '<h2 class="widget-title">Total search results: ' . $the_query->found_posts . '</h2>'; // The Loop if ($the_query->have_posts()) { while ($the_query->have_posts()) { $the_query->the_post(); projectTheme_get_post($post, $i); } if (isset($_GET['pj'])) { $pj = $_GET['pj']; } else { $pj = 1; } $pjsk = $pj; ?> <div class="div_class_div"> <?php $my_page = $pj; $page = $pj; $batch = 10; $nrpostsPage = $nrRes; $end = $batch * $nrpostsPage; if ($end > $pagess) { $end = $pagess; } $start = $end - $nrpostsPage + 1; if ($start < 1) { $start = 1; } $links = ''; $raport = ceil($my_page / $batch) - 1; if ($raport < 0) { $raport = 0; } $start = $raport * $batch + 1; $end = $start + $batch - 1; $end_me = $end + 1; $start_me = $start - 1; if ($end > $totalPages) { $end = $totalPages; } if ($end_me > $totalPages) { $end_me = $totalPages; } if ($start_me <= 0) { $start_me = 1; } $previous_pg = $page - 1; if ($previous_pg <= 0) { $previous_pg = 1; } $next_pg = $pages_curent + 1; if ($next_pg > $totalPages) { $next_pg = 1; } if ($my_page > 1) { echo '<a class="bighi" href="' . projectTheme_advanced_search_link_pgs($previous_pg) . '">' . __("<< Previous", "ProjectTheme") . '</a>'; echo '<a class="bighi" href="' . projectTheme_advanced_search_link_pgs($start_me) . '"><<</a>'; } for ($i = $start; $i <= $end; $i++) { if ($i == $pj) { echo '<a class="bighi" id="activees" href="#">' . $i . '</a>'; } else { echo '<a class="bighi" href="' . projectTheme_advanced_search_link_pgs($i) . '">' . $i . '</a>'; } } $next_pg = $pjsk + 1; if ($totalPages > $my_page) { echo '<a class="bighi" href="' . projectTheme_advanced_search_link_pgs($end_me) . '">>></a>'; } if ($page < $totalPages) { echo '<a class="bighi" href="' . projectTheme_advanced_search_link_pgs($next_pg) . '">' . __("Next >>", "ProjectTheme") . '</a>'; } ?> </div> <?php } else { echo '<div class="my_box3"> <div class="box_content"> '; echo __('No projects posted.', "ProjectTheme"); echo '</div></div>'; } // Reset Post Data wp_reset_postdata(); ?> </div> <div id="right-sidebar"> <li class=""> <h3 class="widget-title"><?php _e('Filter Options', 'ProjectTheme'); ?> </h3> <form method="get" id="filter-form"> <table class="form-table"> <tr> <td><?php _e('Keyword', "ProjectTheme"); ?> :</td> <td><input size="20" class="" value="<?php echo $_GET['term']; ?> " name="term" /></td> </tr> <tr> <td><?php _e('Price', "ProjectTheme"); ?> :</td> <td><?php echo ProjecTheme_get_budgets_dropdown($_GET['budgets'], 'budgets_advanced_search', 1); ?> </td> </tr> <tr> <td><?php _e('Location', "ProjectTheme"); ?> :</td> <td><?php echo ProjectTheme_get_categories_slug("project_location", $_GET['project_location_cat'], __("Select Location", "ProjectTheme"), 'categ_advanced_search'); ?> </td> </tr> <tr> <td><?php _e('Category', "ProjectTheme"); ?> :</td> <td><?php echo ProjectTheme_get_categories_slug("project_cat", $_GET['project_cat_cat'], __("Select Category", "ProjectTheme"), 'categ_advanced_search'); ?> </td> </tr> <tr> <td><?php _e('Featured', "ProjectTheme"); ?> :</td> <td><input type="checkbox" name="featured" value="1" <?php if (isset($_GET['featured'])) { echo 'checked="checked"'; } ?> /></td> </tr> <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.0/jquery-ui.min.js"></script> <link rel="stylesheet" media="all" type="text/css" href="<?php echo get_bloginfo('template_url'); ?> /css/ui_thing.css" /> <script type="text/javascript" language="javascript" src="<?php echo get_bloginfo('template_url'); ?> /js/timepicker.js"></script> <tr> <td><?php _e('Posted from', "ProjectTheme"); ?> :</td> <td> <input size="20" readonly name="time-posted-from" id="time-posted-from" class="filter-date" value="<?php echo $_GET['time-posted-from']; ?> " /></p> </td> </tr> <tr> <td><?php _e('Posted to', "ProjectTheme"); ?> :</td> <td> <input size="20" readonly name="time-posted-to" id="time-posted-to" class="filter-date" value="<?php echo $_GET['time-posted-to']; ?> " /></p> </td> </tr> <tr> <td><?php _e('Visits over', "ProjectTheme"); ?> :</td> <td> <input size="5" type="number" min="0" name="visits-over" id="visits-over" class="visits-over" onkeypress="return isNumberKey(event)" value="<?php if (isset($_GET['visits-over'])) { echo $_GET['visits-over']; } else { echo 0; } ?> " /></p> </td> </tr> <?php do_action('ProjectTheme_adv_search_add_to_form'); ?> <script> function isNumberKey(evt){ var charCode = (evt.which) ? evt.which : event.keyCode if (charCode > 31 && (charCode < 48 || charCode > 57)) return false; return true; } jQuery(document).ready(function() { jQuery('#time-posted-from').datetimepicker({ showSecond: false, timeFormat: 'hh:mm:ss', showButtonPanel: true, beforeShow: function( input ) { setTimeout(function() { var buttonPane = $( input ) .datepicker( "widget" ) .find( ".ui-datepicker-buttonpane" ); var btn = $('<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all"><?php _e('Clear', 'ProjectTheme'); ?> </button>'); btn .unbind("click") .bind("click", function () { $.datepicker._clearDate( input ); jQuery('#time-posted-from').val(''); }); btn.appendTo( buttonPane ); }, 1 ); }, currentText: '<?php _e('Now', 'ProjectTheme'); ?> ', closeText: '<?php _e('Done', 'ProjectTheme'); ?> ', ampm: false, dateFormat: 'mm/dd/yy', timeFormat: 'hh:mm tt', timeSuffix: '', timeOnlyTitle: '<?php _e('Choose Time', 'ProjectTheme'); ?> ', timeText: '<?php _e('Time', 'ProjectTheme'); ?> ', hourText: '<?php _e('Hour', 'ProjectTheme'); ?> ', minuteText: '<?php _e('Minute', 'ProjectTheme'); ?> ', secondText: '<?php _e('Second', 'ProjectTheme'); ?> ', timezoneText: '<?php _e('Time Zone', 'ProjectTheme'); ?> ' }); jQuery('#time-posted-to').datetimepicker({ showSecond: false, timeFormat: 'hh:mm:ss', showButtonPanel: true, beforeShow: function( input ) { setTimeout(function() { var buttonPane = $( input ) .datepicker( "widget" ) .find( ".ui-datepicker-buttonpane" ); var btn = $('<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all"><?php _e('Clear', 'ProjectTheme'); ?> </button>'); btn .unbind("click") .bind("click", function () { $.datepicker._clearDate( input ); jQuery('#time-posted-to').val(''); }); btn.appendTo( buttonPane ); }, 1 ); }, currentText: '<?php _e('Now', 'ProjectTheme'); ?> ', closeText: '<?php _e('Done', 'ProjectTheme'); ?> ', ampm: false, dateFormat: 'mm/dd/yy', timeFormat: 'hh:mm tt', timeSuffix: '', timeOnlyTitle: '<?php _e('Choose Time', 'ProjectTheme'); ?> ', timeText: '<?php _e('Time', 'ProjectTheme'); ?> ', hourText: '<?php _e('Hour', 'ProjectTheme'); ?> ', minuteText: '<?php _e('Minute', 'ProjectTheme'); ?> ', secondText: '<?php _e('Second', 'ProjectTheme'); ?> ', timezoneText: '<?php _e('Time Zone', 'ProjectTheme'); ?> ' });}); </script> <tr style="padding-top: 20px"> <td><input type="submit" value="<?php _e("Refine Search", "ProjectTheme"); ?> " name="ref-search" class="big-search-submit2" /></td> </tr> </table> </form> <div class="clear10"></div> <div style="float:left;width:100%"> <?php $ge = 'order=' . ($_GET['order'] == 'ASC' ? "DESC" : "ASC") . '&meta_key=budgets&orderby=meta_value_num'; foreach ($_GET as $key => $value) { if ($key != 'meta_key' && $key != 'orderby' && $key != 'order') { $ge .= '&' . $key . "=" . $value; } } //------------------------ $ge2 = 'order=' . ($_GET['order'] == 'ASC' ? "DESC" : "ASC") . '&orderby=title'; foreach ($_GET as $key => $value) { if ($key != 'orderby' && $key != 'order') { $ge2 .= '&' . $key . "=" . $value; } } //------------------------ $ge3 = 'order=' . ($_GET['order'] == 'ASC' ? "DESC" : "ASC") . '&meta_key=views&orderby=meta_value_num'; foreach ($_GET as $key => $value) { if ($key != 'meta_key' && $key != 'orderby' && $key != 'order') { $ge3 .= '&' . $key . "=" . $value; } } ?> <?php _e("Order by:", "ProjectTheme"); $ProjectTheme_advanced_search_page_id = get_option('ProjectTheme_advanced_search_page_id'); if (ProjectTheme_using_permalinks()) { $adv = get_permalink($ProjectTheme_advanced_search_page_id) . "?"; } else { $adv = get_permalink($ProjectTheme_advanced_search_page_id) . "&"; } ?> <a href="<?php echo $adv; echo $ge; ?> "><?php _e("Price", "ProjectTheme"); ?> </a> | <a href="<?php echo $adv; echo $ge2; ?> "><?php _e("Name", "ProjectTheme"); ?> </a> | <a href="<?php echo $adv; echo $ge3; ?> "><?php _e("Visits", "ProjectTheme"); ?> </a> </div> <div> <input form="filter-form" type="button" onclick="do_filters_clear()" value="<?php _e("Clear Filters", "ProjectTheme"); ?> " id="clear-filters-btn" name="clear-filters" class="big-search-submit2" /> </div> <script> function do_filters_clear(){ jQuery('#filter-form').find('input,select').not('[name=ref-search]').val(''); jQuery('#filter-form').find('#visits-over').val(0); jQuery('#filter-form').find('input[type=checkbox]').prop( "checked", false ); } </script> </li> <?php dynamic_sidebar('other-page-area'); ?> </div> <?php }