Commit d692be73 authored by Simonas's avatar Simonas

in progress

parent 1d9600c1
...@@ -29,13 +29,13 @@ ...@@ -29,13 +29,13 @@
.c-jobs-section--list { margin: 0; padding: 0; list-style: none; } .c-jobs-section--list { margin: 0; padding: 0; list-style: none; }
/* critical:end */ /* critical:end */
.c-jobs-section--item { line-height: 33px; } .c-jobs-section--item { /* line-height: 33px; */ }
.c-jobs-section--item-active { .c-jobs-section--item-active {
.c-jobs-section--anchor { color: #1FB299; } .c-jobs-section--anchor { color: #1FB299; }
} }
.c-jobs-section--anchor { color: #939393; font-size: 14px; text-decoration: none; .c-jobs-section--anchor { display: block; color: #939393; font-size: 14px; text-decoration: none; padding: 7px 0; line-height: 19px;
&:hover { text-decoration: underline; } &:hover { text-decoration: underline; }
} }
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
...@@ -88,11 +88,11 @@ ...@@ -88,11 +88,11 @@
<?php <?php
endif; endif;
?> ?>
<script src="/wp-content/themes/biuro/js/main-fd6ce50b.min.js" async></script> <script src="/wp-content/themes/biuro/js/main.min.js" async></script>
<?php <?php
// global $time_start; global $time_start;
// delog((microtime(true) - $time_start), 'Lorem ipsum'); delog((microtime(true) - $time_start), 'Lorem ipsum');
?> ?>
<?php wp_footer(); ?> <?php wp_footer(); ?>
</body> </body>
......
...@@ -723,23 +723,60 @@ wp_reset_query(); ...@@ -723,23 +723,60 @@ wp_reset_query();
define('positionsPage', $positionsPage); define('positionsPage', $positionsPage);
function getRecords($type) {
function getRecords($taxonomy, $searchQuery) {
global $wpdb; global $wpdb;
// debug($searchQuery);
// if ($searchQuery['city']):
// $city = get_term_by( 'name', preg_replace('/[\+]/', ' ', $searchQuery['city']), 'city' );
// endif;
// if ($searchQuery['s']):
// $field = get_term_by( 'name', preg_replace('/[\+]/', ' ', $searchQuery['s']), 'field' );
// $type = get_term_by( 'name', preg_replace('/[\+]/', ' ', $searchQuery['s']), 'type' );
// endif;
// if ($taxonomy == 'city'):
// 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;
// if ( $city && $city->term_id == $termID ) :
// $active = true;
// endif;
// elseif ($taxonomy == 'type' || $taxonomy == 'field'):
// if ( $city ) :
// $counter = $counter . ' AND city.term_id = ' . $city->term_id;
// endif;
// if ( $field && $field->term_id == $termID || $type && $type->term_id == $termID) :
// $active = true;
// endif;
// endif;
$langs = pll_the_languages(array('raw'=>1)); $langs = pll_the_languages(array('raw'=>1));
$langID = $langs[pll_current_language('slug')]['id']; $langID = $langs[pll_current_language('slug')]['id'];
$prefix = $wpdb->prefix; $prefix = $wpdb->prefix;
$today = date('Y-m-d'); $today = date('Y-m-d');
$order = ($type == 'city') ? 'no DESC' : 'total DESC'; $order = ($taxonomy == 'city') ? 'no DESC' : 'total DESC';
$sql = "SELECT * FROM (SELECT term.name, count(*) as total, CAST(`{$prefix}termmeta`.`meta_value` as INT) as no, `{$prefix}termpage`.`meta_value` as pageID $sql = "SELECT * FROM (SELECT term.name, count(*) as total, CAST(`termmeta`.`meta_value` as INT) as no, `termpage`.`meta_value` as pageID, `term`.`term_id` as termID, `pages`.`post_title` as title
FROM `{$prefix}posts` AS `t` FROM `{$prefix}posts` AS `t`
LEFT JOIN `{$prefix}postmeta` AS `valid` ON `valid`.`meta_key` = 'valid' AND `valid`.`post_id` = `t`.`ID` LEFT JOIN `{$prefix}postmeta` AS `valid` ON `valid`.`meta_key` = 'valid' AND `valid`.`post_id` = `t`.`ID`
LEFT JOIN `{$prefix}term_relationships` AS `rel_term` ON `rel_term`.`object_id` = `t`.`ID` LEFT JOIN `{$prefix}term_relationships` AS `rel_term` ON `rel_term`.`object_id` = `t`.`ID`
INNER JOIN `{$prefix}term_taxonomy` AS `rel_tt_term` ON `rel_tt_term`.`taxonomy` = '{$type}' AND `rel_tt_term`.`term_taxonomy_id` = `rel_term`.`term_taxonomy_id` INNER JOIN `{$prefix}term_taxonomy` AS `rel_tt_term` ON `rel_tt_term`.`taxonomy` = '{$taxonomy}' AND `rel_tt_term`.`term_taxonomy_id` = `rel_term`.`term_taxonomy_id`
LEFT JOIN `{$prefix}terms` AS `term` ON `term`.`term_id` = `rel_tt_term`.`term_id` LEFT JOIN `{$prefix}terms` AS `term` ON `term`.`term_id` = `rel_tt_term`.`term_id`
LEFT JOIN `{$prefix}termmeta` AS `{$prefix}termmeta` ON {$prefix}termmeta.term_id = term.term_id AND {$prefix}termmeta.meta_key = 'order' LEFT JOIN `{$prefix}termmeta` AS `termmeta` ON termmeta.term_id = term.term_id AND termmeta.meta_key = 'order'
LEFT JOIN `{$prefix}termmeta` AS `{$prefix}termpage` ON {$prefix}termpage.term_id = term.term_id AND {$prefix}termpage.meta_key = 'page-id' LEFT JOIN `{$prefix}termmeta` AS `termpage` ON termpage.term_id = term.term_id AND termpage.meta_key = 'page-id'
LEFT JOIN `{$prefix}posts` AS `pages` ON `pages`.`ID` = `termpage`.`meta_value`
LEFT JOIN `{$prefix}term_relationships` AS `polylang_languages` ON `polylang_languages`.`object_id` = `t`.`ID` AND `polylang_languages`.`term_taxonomy_id` = $langID LEFT JOIN `{$prefix}term_relationships` AS `polylang_languages` ON `polylang_languages`.`object_id` = `t`.`ID` AND `polylang_languages`.`term_taxonomy_id` = $langID
WHERE ( ( `valid`.`meta_value` >= '{$today}' ) AND ( `t`.`post_type` = 'job' ) AND ( `polylang_languages`.`object_id` IS NOT NULL ) AND ( `t`.`post_status` IN ( 'publish' ) ) ) WHERE ( ( `valid`.`meta_value` >= '{$today}' ) AND ( `t`.`post_type` = 'job' ) AND ( `polylang_languages`.`object_id` IS NOT NULL ) AND ( `t`.`post_status` IN ( 'publish' ) ) )
GROUP BY term.name) records GROUP BY term.name) records
......
<?php <?php
// global $time_start; global $time_start;
// $time_start = microtime(true); $time_start = microtime(true);
?><!DOCTYPE html> ?><!DOCTYPE html>
<html <?php language_attributes(); ?>> <html <?php language_attributes(); ?>>
<head> <head>
...@@ -28,16 +28,16 @@ ...@@ -28,16 +28,16 @@
<link rel="preload" as="font" type="font/woff2" href="/wp-content/themes/biuro/fonts/roboto-v19-cyrillic_latin_cyrillic-ext_latin-ext-500.woff2" crossorigin="anonymous" > <link rel="preload" as="font" type="font/woff2" href="/wp-content/themes/biuro/fonts/roboto-v19-cyrillic_latin_cyrillic-ext_latin-ext-500.woff2" crossorigin="anonymous" >
<link rel="preload" as="font" type="font/woff2" href="/wp-content/themes/biuro/fonts/roboto-v19-cyrillic_latin_cyrillic-ext_latin-ext-regular.woff2" crossorigin="anonymous" > <link rel="preload" as="font" type="font/woff2" href="/wp-content/themes/biuro/fonts/roboto-v19-cyrillic_latin_cyrillic-ext_latin-ext-regular.woff2" crossorigin="anonymous" >
<style><?php include 'css/core-2c5fc4a3fd.min.css'; ?></style> <style><?php include 'css/core.min.css'; ?></style>
<link rel="preload" as="font" type="font/woff2" href="/wp-content/themes/biuro/fonts/roboto-v19-cyrillic_latin_cyrillic-ext_latin-ext-300.woff2" crossorigin="anonymous" > <link rel="preload" as="font" type="font/woff2" href="/wp-content/themes/biuro/fonts/roboto-v19-cyrillic_latin_cyrillic-ext_latin-ext-300.woff2" crossorigin="anonymous" >
<link rel="preload" as="font" type="font/woff2" href="/wp-content/themes/biuro/fonts/roboto-v19-cyrillic_latin_cyrillic-ext_latin-ext-700.woff2" crossorigin="anonymous" > <link rel="preload" as="font" type="font/woff2" href="/wp-content/themes/biuro/fonts/roboto-v19-cyrillic_latin_cyrillic-ext_latin-ext-700.woff2" crossorigin="anonymous" >
<link rel="preload" href="/wp-content/themes/biuro/css/main-635d633349.min.css" as="style" onload="this.rel='stylesheet'"> <link rel="preload" href="/wp-content/themes/biuro/css/main.min.css" as="style" onload="this.rel='stylesheet'">
<noscript> <noscript>
<link rel="stylesheet" href="/wp-content/themes/biuro/css/main-635d633349.min.css"> <link rel="stylesheet" href="/wp-content/themes/biuro/css/main.min.css">
</noscript> </noscript>
<?php wp_head(); ?> <?php wp_head(); ?>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
...@@ -16,7 +16,7 @@ function getPageURL($taxonomy, $pageURL, $searchQuery, $termID) { ...@@ -16,7 +16,7 @@ function getPageURL($taxonomy, $pageURL, $searchQuery, $termID) {
return $pageURL; return $pageURL;
} }
function getSiteTree($taxonomy, $section, $searchQuery) { function getSiteTree2($taxonomy, $section, $searchQuery) {
$terms = get_terms( array( $terms = get_terms( array(
'taxonomy' => $taxonomy, 'taxonomy' => $taxonomy,
'hide_empty' => false, 'hide_empty' => false,
...@@ -150,6 +150,62 @@ function getSiteTree($taxonomy, $section, $searchQuery) { ...@@ -150,6 +150,62 @@ function getSiteTree($taxonomy, $section, $searchQuery) {
} }
function getSiteTree($type, $section, $searchQuery, $term) {
$res = array();
$termID = $term ? $term->term_id : '';
$pages = getRecords($type, $searchQuery);
foreach ( $pages as $page ):
if ($page['pageID']) :
array_push($res, array(
'name' => $page['title'],
'href' => getPageURL($type, get_page_link( $page['pageID'] ), $searchQuery, $page['termID']),
'total' => $page['total'],
'active' => $page['termID'] == $termID ? true : false
));
endif;
endforeach;
$counter = count($res);
if ($counter == 0) {
return '';
}
$classCSS = 'c-jobs-section';
$isClosed = $counter > 3;
if ($isClosed):
$classCSS .= ' c-jobs-section--is-closed';
endif;
echo '<div class="' . $classCSS . '">';
echo '<h3 class="c-jobs-section--heading">' . $section . '</h3>';
echo '<div class="c-jobs-section--content">';
echo '<ul class="c-jobs-section--list">';
foreach ( $res as $r ):
?>
<li class="c-jobs-section--item <?php if ($r['active']): echo 'c-jobs-section--item-active'; endif; ?>"><a href="<?php echo $r['href']; ?>" title="<?php echo $r['name']; ?>" class="c-jobs-section--anchor"><?php echo $r['name'] . ' (' . $r['total'] . ')'; ?></a></li>
<?php
endforeach;
echo '</ul>';
echo '</div>';
if ($isClosed):
echo '<a href="#" class="js-expand-jobs-section c-jobs-section--expand">' . __('More ...', 'biuro') . ' </a>';
endif;
echo '</div>';
}
global $query_string; global $query_string;
wp_parse_str( $query_string, $searchQuery ); wp_parse_str( $query_string, $searchQuery );
...@@ -164,15 +220,24 @@ function getSiteTree($taxonomy, $section, $searchQuery) { ...@@ -164,15 +220,24 @@ function getSiteTree($taxonomy, $section, $searchQuery) {
endif; endif;
endif; endif;
getSiteTree( 'city', __('City', 'biuro'), $searchQuery ); if ($searchQuery['city']):
$city = get_term_by( 'name', preg_replace('/[\+]/', ' ', $searchQuery['city']), 'city' );
endif;
if ($searchQuery['s']):
$field = get_term_by( 'name', preg_replace('/[\+]/', ' ', $searchQuery['s']), 'field' );
$type = get_term_by( 'name', preg_replace('/[\+]/', ' ', $searchQuery['s']), 'type' );
endif;
getSiteTree( 'city', __('City', 'biuro'), $searchQuery, $city );
?> ?>
<?php <?php
getSiteTree( 'field', __('Job area', 'biuro'), $searchQuery ); getSiteTree( 'field', __('Job area', 'biuro'), $searchQuery, $field );
?> ?>
<?php <?php
getSiteTree( 'type', __('Job type', 'biuro'), $searchQuery ); getSiteTree( 'type', __('Job type', 'biuro'), $searchQuery, $type );
?> ?>
<?php <?php
......
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