Commit 861276f7 authored by Simonas's avatar Simonas

search and links updated

parent 5f7b78ee
......@@ -20,9 +20,9 @@
## Production
- build CSS & JS assets - `C:\web\dev.biuro\ npm run build`
- build new image `docker build -t biuro/web:0.0.27 .` (update version number)
- build new image `docker build -t biuro/web:0.0.28 .` (update version number)
- login to biuro docker account `docker login --username=biuro --password=9Ndtjd2vKsLvGuFOeFq1KdJs`
- push image to docker repository - `docker push biuro/web:0.0.27`
- push image to docker repository - `docker push biuro/web:0.0.28`
## Production
- update biuro/web image version in .env file (staging or www)
......@@ -30,12 +30,18 @@
- login to server via ssh and navigatate to root folder (biuro-staging or wwww)
- login to biuro docker account - `sudo docker login --username=biuro --password=9Ndtjd2vKsLvGuFOeFq1KdJs`
- use new image version - `sudo docker-compose up -d`
- exit - `exit`
### staging
### connect to servers
- generate ppk file from `!information/ssh-keys/biurolt.pem` key
- save on your PC, DO NOT OVERWITE existing ones. There is ssh/ folder added to gitignore, you can store them here.
- login su ssh or ftp using generated personal ppk key
### staging.biuro.lt (staging.www)
- server: 18.197.154.248
- user: ubuntu
### live
### biuro.lt (www)
- server: 18.195.10.89
- user: admin
......
......@@ -23,7 +23,7 @@
.c-feedbacks--section { padding-top: 40px; }
.c-feedbacks--section-inner { position: relative; height: 110px; width: 320px; margin: 0 5px; padding: 60px 0 0; border-radius: 23px; background-color: #FFFFFF;
@media (--min--medium) {
height: 140px; width: 574px;
height: 140px; width: 574px; margin: 0 33px;
}
}
......
......@@ -7,7 +7,9 @@
.pods-pagination-paginate { display: flex; margin-bottom: 90px; }
.page-numbers { width: 46px; height: 46px; background: #fff; margin-right: 1px; text-decoration: none; text-align: center; line-height: 46px; color: #1FB299; font-size: 16px;
&:hover { background: var(--color--green-darker); color: #FFFFFF; }
&:hover { background: var(--color--green-darker); color: #FFFFFF;
&:after { border-color: #fff; }
}
&.current { background: #1FB299; color: #FFFFFF; }
}
.next {
......
......@@ -80,6 +80,7 @@
<?php
endwhile;
endif;
wp_reset_query();
?>
......
......@@ -564,3 +564,33 @@ function wpseo_canonical_exclude( $canonical ) {
return false;
}
add_filter( 'wpseo_canonical', 'wpseo_canonical_exclude' );
function getPageTerm($keys) {
if ($keys):
foreach ( $keys as $key => $value ) :
$val = trim($value);
$taxonomy = substr($val, 20);
if ( '_' == $val{0} || substr($val, 0, 20) != 'built_in_taxonomies_' || !$taxonomy):
continue;
endif;
$res = get_post_custom_values( $val, $ID );
if ( !$res ) :
continue;
endif;
$term = $res[0];
if ( !$term ) :
continue;
endif;
return get_term_by( 'slug', $term, $taxonomy );
endforeach;
endif;
return null;
}
<?php
$searchQuery = get_search_query();
$cityID = get_query_var('city');
$cityID = is_numeric($cityID) ? $cityID : '';
define('searchQuery', $searchQuery);
define('cityID', $cityID);
?><!DOCTYPE html>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
......@@ -32,16 +23,16 @@ define('cityID', $cityID);
?>
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700" rel="stylesheet">
<style><?php include 'css/core-9030edd8cb.min.css'; ?></style>
<style><?php include 'css/core-4b9d1f19e3.min.css'; ?></style>
<link rel="preload" href="/wp-content/themes/biuro/css/main-667185c0a1.min.css" as="style" onload="this.rel='stylesheet'">
<link rel="preload" href="/wp-content/themes/biuro/css/main-40683cd0ec.min.css" as="style" onload="this.rel='stylesheet'">
<link rel="preload" href="/wp-content/themes/biuro/fonts/pt_sans_narrow.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="/wp-content/themes/biuro/fonts/pt_sans_narrow_bold.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="/wp-content/themes/biuro/fonts/bebas-neue.woff2" as="font" type="font/woff2" crossorigin>
<noscript>
<link rel="stylesheet" href="/wp-content/themes/biuro/css/main-667185c0a1.min.css">
<link rel="stylesheet" href="/wp-content/themes/biuro/css/main-40683cd0ec.min.css">
</noscript>
<?php wp_head(); ?>
......@@ -146,8 +137,8 @@ global $post;
<a href="<?php echo get_the_permalink(); ?>?#action" class="o-btn c-btn--main c-btn--header"><?php _e('Get an offer', 'biuro'); ?></a>
<?php
endwhile;
wp_reset_query();
endif;
wp_reset_query();
else:
$contactsPage = new WP_Query( array(
......@@ -164,8 +155,8 @@ global $post;
<a href="<?php echo get_the_permalink(); ?>?#action" class="o-btn c-btn--main c-btn--header"><?php _e('Get a job offer', 'biuro'); ?></a>
<?php
endwhile;
wp_reset_query();
endif;
wp_reset_query();
endif;
?>
......
......@@ -168,8 +168,8 @@ get_header(); ?>
<a href="<?php echo get_the_permalink(); ?>?#action" class="o-btn c-btn--vdb"><?php _e('Get a job offer', 'biuro'); ?></a>
<?php
endwhile;
wp_reset_query();
endif;
wp_reset_query();
?>
</div>
......
......@@ -8,9 +8,23 @@
* @version 1.0
*/
global $query_string;
global $query_string;
wp_parse_str( $query_string, $searchQuery );
if ( get_post_type() == 'page' ):
$pageTerms = getPageTerm(get_post_custom_keys());
if ($pageTerms):
if ($pageTerms->taxonomy === 'type' || $pageTerms->taxonomy === 'field'):
$searchQuery['s'] = $pageTerms->name;
elseif ($pageTerms->taxonomy === 'city'):
$searchQuery['city'] = $pageTerms->name;
endif;
endif;
endif;
wp_parse_str( $query_string, $searchQuery );
?>
<form id="search" class="c-search" action="<?php echo home_url(); ?>" method="get">
......@@ -36,6 +50,22 @@
$termID = $city->term_id;
$where = 'valid.meta_value > "' . date('Y-m-d', strtotime('-1 days')) . '" AND city.term_id = ' . $termID;
$counter = $where;
if ( $searchQuery['s'] ) :
$field = get_term_by( 'name', preg_replace('/[\+]/', ' ', $searchQuery['s']), 'field' );
$type = get_term_by( 'name', preg_replace('/[\+]/', ' ', $searchQuery['s']), 'type' );
if ( $field ) :
$counter = $counter . ' AND field.term_id = ' . $field->term_id;
elseif ( $type ) :
$counter = $counter . ' AND type.term_id = ' . $type->term_id;
else:
$counter = $counter . ' AND (t.post_title LIKE "%' . $searchQuery['s'] . '%" OR t.post_content LIKE "%' . $searchQuery['s'] . '%")';
endif;
endif;
$params = array(
'where' => $where,
......@@ -44,13 +74,20 @@
$jobsIn = pods( 'job', $params );
$custom = array(
'where' => $counter,
'limit' => -1
);
$jobsCounter = pods( 'job', $custom );
if ( 0 < $jobsIn->total() ):
$order = intval(get_term_meta( $termID, 'order', true));
array_push($res, array(
'name' => $name,
'order' => $order,
'total' => $jobsIn->total()
'total' => $jobsCounter->total()
));
endif;
......@@ -74,7 +111,7 @@
endforeach;
?>
</datalist>
<input list="search-cities" id="search-city" name="city" value="<?php echo ($searchQuery) ? $searchQuery['city'] : ''; ?>" placeholder="<?php _e('Locations', 'biuro'); ?>" class="c-search--input c-search--location" />
<input list="search-cities" id="search-city" name="city" value="<?php echo ($searchQuery && $searchQuery['city']) ? trim(urldecode($searchQuery['city'])) : ''; ?>" placeholder="<?php _e('Locations', 'biuro'); ?>" class="c-search--input c-search--location" />
<?php
endif;
?>
......@@ -95,6 +132,15 @@
$termID = $type->term_id;
$where = 'valid.meta_value > "' . date('Y-m-d', strtotime('-1 days')) . '" AND type.term_id = ' . $termID;
$counter = $where;
if ( $searchQuery['city'] ) :
$city = get_term_by( 'name', preg_replace('/[\+]/', ' ', $searchQuery['city']), 'city' );
if ( $city ) :
$counter = $counter . ' AND city.term_id = ' . $city->term_id;
endif;
endif;
$params = array(
'where' => $where,
......@@ -103,8 +149,15 @@
$jobsIn = pods( 'job', $params );
$custom = array(
'where' => $counter,
'limit' => -1
);
$jobsTerms = pods( 'job', $custom );
if ( 0 < $jobsIn->total() ):
array_push( $options , array( 'name' => $name, 'total' => $jobsIn->total() ) );
array_push( $options , array( 'name' => $name, 'total' => $jobsTerms->total() ) );
endif;
endforeach;
endif;
......@@ -127,6 +180,15 @@
$termID = $field->term_id;
$where = 'valid.meta_value > "' . date('Y-m-d', strtotime('-1 days')) . '" AND field.term_id = ' . $termID;
$counter = $where;
if ( $searchQuery['city'] ) :
$city = get_term_by( 'name', preg_replace('/[\+]/', ' ', $searchQuery['city']), 'city' );
if ( $city ) :
$counter = $counter . ' AND city.term_id = ' . $city->term_id;
endif;
endif;
$params = array(
'where' => $where,
......@@ -135,8 +197,15 @@
$jobsIn = pods( 'job', $params );
$custom = array(
'where' => $counter,
'limit' => -1
);
$jobsFields = pods( 'job', $custom );
if ( 0 < $jobsIn->total() ):
array_push( $options , array( 'name' => $name, 'total' => $jobsIn->total() ) );
array_push( $options , array( 'name' => $name, 'total' => $jobsFields->total() ) );
endif;
endforeach;
......@@ -158,7 +227,7 @@
endforeach;
?>
</datalist>
<input list="search-queries" id="search-query" name="s" value="<?php echo ($searchQuery) ? $searchQuery['s'] : ''; ?>" placeholder="<?php _e('Keyword', 'biuro'); ?>" class="c-search--input c-search--keyword" />
<input list="search-queries" id="search-query" name="s" value="<?php echo ($searchQuery && $searchQuery['s']) ? trim(urldecode($searchQuery['s'])) : ''; ?>" placeholder="<?php _e('Keyword', 'biuro'); ?>" class="c-search--input c-search--keyword" />
<?php
endif;
?>
......
......@@ -12,3 +12,24 @@
?>
<p><?php _e('No search results were found.', 'biuro'); ?></p>
<?php
$positionsPage = new WP_Query( array(
'numberposts' => 1,
'post_type' => 'page',
'meta_key' => 'page',
'meta_value' => 'positions'
) );
if ( $positionsPage->have_posts() ) :
while( $positionsPage->have_posts() ) :
$positionsPage->the_post();
?>
<p>
<a href="<?php echo get_the_permalink(); ?>" class="o-btn c-btn--main"><?php _e('More job ads', 'biuro'); ?></a>
</p>
<?php
endwhile;
endif;
wp_reset_query();
?>
<?php
function getSiteTree($taxonomy, $section)
function getPageURL($taxonomy, $pageURL, $searchQuery, $termID) {
$term = get_term($termID);
if (!$term || !$term->name):
return $pageURL;
endif;
if ($searchQuery['s'] && $taxonomy == 'city'):
return '/?city=' . $term->name . '&s=' . $searchQuery['s'];
elseif ($searchQuery['city'] && ($taxonomy == 'type' || $taxonomy == 'field')):
return '/?city=' . $searchQuery['city'] . '&s=' . $term->name;
endif;
return $pageURL;
}
function getSiteTree($taxonomy, $section, $searchQuery)
{
$terms = get_terms( array(
'taxonomy' => $taxonomy,
......@@ -13,6 +30,28 @@ function getSiteTree($taxonomy, $section)
$termID = $term->term_id;
$where = 'valid.meta_value > "' . date('Y-m-d', strtotime('-1 days')) . '" AND ' . $taxonomy . '.term_id = ' . $termID;
$counter = $where;
if ($searchQuery['s'] && $taxonomy == 'city'):
$field = get_term_by( 'name', preg_replace('/[\+]/', ' ', $searchQuery['s']), 'field' );
$type = get_term_by( 'name', preg_replace('/[\+]/', ' ', $searchQuery['s']), 'type' );
if ( $field ) :
$counter = $counter . ' AND field.term_id = ' . $field->term_id;
elseif ( $type ) :
$counter = $counter . ' AND type.term_id = ' . $type->term_id;
else:
$counter = $counter . ' AND (t.post_title LIKE "%' . $searchQuery['s'] . '%" OR t.post_content LIKE "%' . $searchQuery['s'] . '%")';
endif;
elseif ($searchQuery['city'] && ($taxonomy == 'type' || $taxonomy == 'field')):
$city = get_term_by( 'name', preg_replace('/[\+]/', ' ', $searchQuery['city']), 'city' );
if ( $city ) :
$counter = $counter . ' AND city.term_id = ' . $city->term_id;
endif;
endif;
$params = array(
'where' => $where,
......@@ -21,6 +60,13 @@ function getSiteTree($taxonomy, $section)
$jobsIn = pods( 'job', $params );
$custom = array(
'where' => $counter,
'limit' => -1
);
$jobsCounter = pods( 'job', $custom );
if ( 0 < $jobsIn->total() ):
$page = get_term_meta( $termID, 'page-id', true);
$order = intval(get_term_meta( $termID, 'order', true));
......@@ -29,9 +75,9 @@ function getSiteTree($taxonomy, $section)
array_push($res, array(
'name' => $page['post_title'],
'href' => get_page_link( $page['ID'] ),
'href' => getPageURL($taxonomy, get_page_link( $page['ID'] ), $searchQuery, $termID),
'order' => $order,
'total' => $jobsIn->total()
'total' => $jobsCounter->total()
));
endif;
......@@ -90,19 +136,32 @@ function getSiteTree($taxonomy, $section)
endif;
}
?>
<?php
getSiteTree( 'city', __('City', 'biuro') );
global $query_string;
wp_parse_str( $query_string, $searchQuery );
$pageTerms = getPageTerm(get_post_custom_keys());
if ($pageTerms):
if ($pageTerms->taxonomy === 'type' || $pageTerms->taxonomy === 'field'):
$searchQuery['s'] = $pageTerms->name;
elseif ($pageTerms->taxonomy === 'city'):
$searchQuery['city'] = $pageTerms->name;
endif;
endif;
getSiteTree( 'city', __('City', 'biuro'), $searchQuery );
?>
<?php
getSiteTree( 'field', __('Job area', 'biuro') );
getSiteTree( 'field', __('Job area', 'biuro'), $searchQuery );
?>
<?php
getSiteTree( 'type', __('Job type', 'biuro') );
getSiteTree( 'type', __('Job type', 'biuro'), $searchQuery );
?>
......@@ -129,8 +188,8 @@ function getSiteTree($taxonomy, $section)
<a href="<?php echo get_the_permalink(); ?>?#action" class="o-btn c-btn--vdb"><?php _e('Get a job offer', 'biuro'); ?></a>
<?php
endwhile;
wp_reset_query();
endif;
wp_reset_query();
?>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment