Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dev.biuro
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Biuro
dev.biuro
Commits
a63dcfa0
Commit
a63dcfa0
authored
May 31, 2019
by
Simonas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
City & Categories ordering, optimization
parent
781f20f5
Changes
9
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
69 additions
and
318 deletions
+69
-318
footer.php
wp-content/themes/biuro/footer.php
+2
-2
functions.php
wp-content/themes/biuro/functions.php
+48
-109
header.php
wp-content/themes/biuro/header.php
+2
-8
page-divisions.php
wp-content/themes/biuro/page-divisions.php
+0
-34
page-vasaros-darbu-bankas.php
wp-content/themes/biuro/page-vasaros-darbu-bankas.php
+1
-1
search.php
wp-content/themes/biuro/search.php
+1
-2
searchform.php
wp-content/themes/biuro/searchform.php
+4
-13
jobs-list.php
wp-content/themes/biuro/template-parts/jobs/jobs-list.php
+2
-1
aside-job-list.php
...ent/themes/biuro/template-parts/layout/aside-job-list.php
+9
-148
No files found.
wp-content/themes/biuro/footer.php
View file @
a63dcfa0
...
...
@@ -91,8 +91,8 @@
<script
src=
"/wp-content/themes/biuro/js/main.min.js"
async
></script>
<?php
global
$time_start
;
delog
((
microtime
(
true
)
-
$time_start
),
'Lorem ipsum'
);
//
global $time_start;
//
delog((microtime(true) - $time_start), 'Lorem ipsum');
?>
<?php
wp_footer
();
?>
</body>
...
...
wp-content/themes/biuro/functions.php
View file @
a63dcfa0
This diff is collapsed.
Click to expand it.
wp-content/themes/biuro/header.php
View file @
a63dcfa0
<?php
global
$time_start
;
$time_start
=
microtime
(
true
);
// getRecords('city');
// getRecords('field');
// getRecords('type');
// global $time_start;
// $time_start = microtime(true);
?><!DOCTYPE html>
<html
<?php
language_attributes
();
?>
>
<head>
...
...
wp-content/themes/biuro/page-divisions.php
View file @
a63dcfa0
...
...
@@ -49,52 +49,18 @@ get_header(); ?>
<div
class=
"c-divisions"
>
<?php
if
(
1
<
$divisions
->
total
()
)
:
/*
$divisionsPage = new WP_Query( array(
'numberposts' => 1,
'post_type' => 'page',
'meta_key' => 'page',
'meta_value' => 'employees-contacts'
) );
if ( $divisionsPage->have_posts() ) :
while( $divisionsPage->have_posts() ) :
$divisionsPage->the_post();
?>
<a class="c-division <?php if ( $total == 0 ) { echo 'c-division--active'; } ?>" href="<?php the_permalink(); ?>"><?php _e('All', 'biuro'); ?></a>
<?php
endwhile;
else:
*/
?>
<span
class=
"js-division c-division"
>
<?php
_e
(
'All'
,
'biuro'
);
?>
</span>
<?php
/*
endif;
*/
wp_reset_query
();
endif
;
while
(
$divisions
->
fetch
()
)
:
$slug
=
$divisions
->
display
(
'city.slug'
);
if
(
!
in_array
(
$slug
,
$cities
)
&&
$divisions
->
display
(
'name'
)
)
:
/*
$page = $divisions->field( 'page-id' );
if ( !empty( $page ) ):
?>
<a class="js-division c-division <?php if ( $pageID == $page['ID'] ) { echo 'c-division--active'; } ?>" data-id="<?php echo $slug; ?>" href="<?php echo esc_url( get_permalink( $page['ID'] ) ); ?>"><?php echo $divisions->display( 'city' ); ?></a>
<?php
else:
*/
?>
<span
class=
"js-division c-division"
data-id=
"
<?php
echo
$slug
;
?>
"
>
<?php
echo
$divisions
->
display
(
'city'
);
?>
</span>
<?php
/*
endif;
*/
array_push
(
$cities
,
$slug
);
endif
;
endwhile
;
...
...
wp-content/themes/biuro/page-vasaros-darbu-bankas.php
View file @
a63dcfa0
...
...
@@ -125,7 +125,7 @@ get_header(); ?>
continue
;
endif
;
$res
=
get_post_custom_values
(
$val
,
$ID
);
$res
=
get_post_custom_values
(
$val
);
if
(
!
$res
)
:
continue
;
...
...
wp-content/themes/biuro/search.php
View file @
a63dcfa0
...
...
@@ -74,7 +74,6 @@ get_header(); ?>
<?php
global
$query_string
;
$ID
=
get_the_ID
();
$keys
=
get_post_custom_keys
();
$where
=
'valid.meta_value > "'
.
date
(
'Y-m-d'
,
strtotime
(
'-1 days'
))
.
'"'
;
...
...
@@ -120,7 +119,7 @@ get_header(); ?>
continue
;
endif
;
$res
=
get_post_custom_values
(
$val
,
$ID
);
$res
=
get_post_custom_values
(
$val
);
if
(
!
$res
)
:
continue
;
...
...
wp-content/themes/biuro/searchform.php
View file @
a63dcfa0
...
...
@@ -28,12 +28,6 @@ if ( get_post_type() == 'page' ):
endif
;
?>
<?php
// $res = getRecords('city', $searchQuery);
// debug($res);
// exit();
?>
<form
id=
"search"
class=
"c-search"
action=
"
<?php
echo
home_url
();
?>
"
method=
"get"
>
...
...
@@ -43,16 +37,14 @@ endif;
</svg>
<datalist
id=
"search-cities"
>
<?php
$res
=
getRecords
(
'city'
,
$searchQuery
);
foreach
(
$res
as
$r
)
:
foreach
(
getOptions
(
'city'
)
as
$r
)
:
?>
<option
value=
"
<?php
echo
$r
[
'name'
];
?>
"
>
<?php
echo
$r
[
'name'
];
?>
(
<?php
echo
$r
[
'total'
];
?>
)
</option>
<?php
endforeach
;
?>
</datalist>
<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"
/>
<input
list=
"search-cities"
id=
"search-city"
name=
"city"
value=
"
<?php
echo
(
isset
(
$searchQuery
[
'city'
])
)
?
trim
(
urldecode
(
$searchQuery
[
'city'
]))
:
''
;
?>
"
placeholder=
"
<?php
_e
(
'Locations'
,
'biuro'
);
?>
"
class=
"c-search--input c-search--location"
/>
</div>
<!-- .c-search--col c-search--col-location -->
<div
class=
"c-search--col c-search--col-keyword"
>
...
...
@@ -62,15 +54,14 @@ endif;
<datalist
id=
"search-queries"
>
<?php
$options
=
array_merge
(
getRecords
(
'field'
,
$searchQuery
),
getRecords
(
'type'
,
$searchQuery
));
foreach
(
$options
as
$option
)
:
foreach
(
array_merge
(
getOptions
(
'field'
),
getOptions
(
'type'
))
as
$option
)
:
?>
<option
value=
"
<?php
echo
$option
[
'name'
];
?>
"
>
<?php
echo
$option
[
'name'
];
?>
(
<?php
echo
$option
[
'total'
];
?>
)
</option>
<?php
endforeach
;
?>
</datalist>
<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"
/>
<input
list=
"search-queries"
id=
"search-query"
name=
"s"
value=
"
<?php
echo
(
isset
(
$searchQuery
[
's'
])
)
?
trim
(
urldecode
(
$searchQuery
[
's'
]))
:
''
;
?>
"
placeholder=
"
<?php
_e
(
'Keyword'
,
'biuro'
);
?>
"
class=
"c-search--input c-search--keyword"
/>
</div>
<!-- .c-search--col c-search--col-keyword -->
<button
class=
"o-btn c-btn--main
<?php
if
(
is_front_page
()
)
:
?>
c-btn--search
<?php
else
:
?>
c-btn--search-small
<?php
endif
;
?>
"
type=
"submit"
value=
"1"
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"17px"
height=
"17px"
viewBox=
"0 0 17 17"
class=
"c-ico--search"
>
...
...
wp-content/themes/biuro/template-parts/jobs/jobs-list.php
View file @
a63dcfa0
...
...
@@ -17,6 +17,7 @@ global $jobs;
$i
=
0
;
while
(
$jobs
->
fetch
()
)
:
$ID
=
$jobs
->
display
(
'ID'
);
$name
=
$jobs
->
display
(
'name'
);
//Primary city id
$primaryCities
=
get_post_meta
(
$ID
,
'_yoast_wpseo_primary_city'
);
...
...
@@ -25,7 +26,7 @@ global $jobs;
?>
<tr
<?php
if
(
$i
%
2
!=
0
)
{
echo
'class="c-jobs--row-odd"'
;
}
?>
>
<td
class=
"c-jobs--col c-jobs--col-position"
>
<a
class=
"c-jobs--anchor"
href=
"
<?php
echo
get_post_permalink
(
$ID
);
?>
"
title=
"
<?php
echo
$
jobs
->
display
(
'name'
);
?>
"
>
<?php
echo
$jobs
->
display
(
'name'
)
;
?>
</a>
<a
class=
"c-jobs--anchor"
href=
"
<?php
echo
get_post_permalink
(
$ID
);
?>
"
title=
"
<?php
echo
$
name
;
?>
"
>
<?php
echo
$name
;
?>
</a>
</td>
<td
class=
"c-jobs--col c-jobs--col-city"
>
<?php
...
...
wp-content/themes/biuro/template-parts/layout/aside-job-list.php
View file @
a63dcfa0
...
...
@@ -16,157 +16,14 @@ function getPageURL($taxonomy, $pageURL, $searchQuery, $termID) {
return
$pageURL
;
}
function
getSiteTree2
(
$taxonomy
,
$section
,
$searchQuery
)
{
$terms
=
get_terms
(
array
(
'taxonomy'
=>
$taxonomy
,
'hide_empty'
=>
false
,
));
if
(
!
empty
(
$terms
)
&&
!
is_wp_error
(
$terms
)
)
:
$res
=
array
();
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
;
foreach
(
$terms
as
$term
)
:
$termID
=
$term
->
term_id
;
$active
=
false
;
$where
=
'valid.meta_value > "'
.
date
(
'Y-m-d'
,
strtotime
(
'-1 days'
))
.
'" AND '
.
$taxonomy
.
'.term_id = '
.
$termID
;
$counter
=
$where
;
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
;
$params
=
array
(
'where'
=>
$where
,
'limit'
=>
-
1
);
$jobsIn
=
pods
(
'job'
,
$params
);
$custom
=
array
(
'where'
=>
$counter
,
'limit'
=>
-
1
);
$jobsCounter
=
pods
(
'job'
,
$custom
);
// global $wpdb;
// if ($taxonomy == 'field') {
// delog($wpdb->last_query, 'last_query');
// debug($wpdb->last_result);
// }
if
(
0
<
$jobsIn
->
total
()
)
:
$page
=
get_term_meta
(
$termID
,
'page-id'
,
true
);
$order
=
intval
(
get_term_meta
(
$termID
,
'order'
,
true
));
if
(
$page
&&
$page
[
'post_status'
]
===
'publish'
)
:
array_push
(
$res
,
array
(
'name'
=>
$page
[
'post_title'
],
'href'
=>
getPageURL
(
$taxonomy
,
get_page_link
(
$page
[
'ID'
]
),
$searchQuery
,
$termID
),
'order'
=>
$order
,
'total'
=>
$jobsCounter
->
total
(),
'active'
=>
$active
));
endif
;
endif
;
endforeach
;
if
(
count
(
$res
)
==
0
)
{
return
''
;
}
usort
(
$res
,
function
(
$a
,
$b
)
{
$o
=
$b
[
'order'
]
-
$a
[
'order'
];
if
(
$o
)
:
return
$o
;
endif
;
$t
=
$b
[
'total'
]
-
$a
[
'total'
];
if
(
$t
)
:
return
$t
;
endif
;
return
$a
[
'name'
]
>
$b
[
'name'
];
});
$classCSS
=
'c-jobs-section'
;
$isClosed
=
count
(
$res
)
>
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>'
;
endif
;
}
function
getSiteTree
(
$type
,
$section
,
$searchQuery
,
$term
)
{
$res
=
array
();
$termID
=
$term
?
$term
->
term_id
:
''
;
$termID
=
$term
!=
''
?
$term
->
term_id
:
''
;
$pages
=
get
Records
(
$type
,
$searchQuery
);
$pages
=
get
Options
(
$type
);
foreach
(
$pages
as
$page
)
:
if
(
$page
[
'pageID'
])
:
if
(
$page
[
'pageID'
]
&&
$page
[
'status'
]
==
'publish'
)
:
array_push
(
$res
,
array
(
'name'
=>
$page
[
'title'
],
'href'
=>
getPageURL
(
$type
,
get_page_link
(
$page
[
'pageID'
]
),
$searchQuery
,
$page
[
'termID'
]),
...
...
@@ -227,11 +84,15 @@ function getSiteTree($type, $section, $searchQuery, $term) {
endif
;
endif
;
if
(
$searchQuery
[
'city'
])
:
$city
=
''
;
$field
=
''
;
$type
=
''
;
if
(
isset
(
$searchQuery
[
'city'
]))
:
$city
=
get_term_by
(
'name'
,
preg_replace
(
'/[\+]/'
,
' '
,
$searchQuery
[
'city'
]),
'city'
);
endif
;
if
(
$searchQuery
[
's'
]
)
:
if
(
isset
(
$searchQuery
[
's'
])
)
:
$field
=
get_term_by
(
'name'
,
preg_replace
(
'/[\+]/'
,
' '
,
$searchQuery
[
's'
]),
'field'
);
$type
=
get_term_by
(
'name'
,
preg_replace
(
'/[\+]/'
,
' '
,
$searchQuery
[
's'
]),
'type'
);
endif
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment