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
f98ebdf6
Commit
f98ebdf6
authored
Mar 13, 2019
by
Simonas
Browse files
Options
Browse Files
Download
Plain Diff
merge dev
parents
02f58cef
a4e9f1cc
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
2588 additions
and
155 deletions
+2588
-155
data-003.sql
!information/!backup/docker/mariadb/data-003.sql
+0
-0
data-005.sql
docker/mariadb/data-005.sql
+2089
-0
JobsImporter.php
wp-content/plugins/jobs-importer/JobsImporter.php
+381
-0
jobs-importer.php
wp-content/plugins/jobs-importer/jobs-importer.php
+118
-0
_unused_footer-job.php
wp-content/themes/biuro/_unused_footer-job.php
+0
-29
_unused_header-job.php
wp-content/themes/biuro/_unused_header-job.php
+0
-45
page-jobs.php
wp-content/themes/biuro/page-jobs.php
+0
-81
No files found.
docker/mariadb/data-003.sql
→
!information/!backup/
docker/mariadb/data-003.sql
View file @
f98ebdf6
File moved
docker/mariadb/data-005.sql
0 → 100644
View file @
f98ebdf6
This source diff could not be displayed because it is too large. You can
view the blob
instead.
wp-content/plugins/jobs-importer/JobsImporter.php
0 → 100644
View file @
f98ebdf6
<?php
/**
* Class JobsImporter - Import data to WP posts with custom fields
*
* @uses Pods framework
* @package Biuro Jobs importer
* @used-by \jobs-importer\job-importer.php
*/
class
JobsImporter
{
private
$data
;
// Biuro record unique key
protected
$primaryKey
=
'livas-id'
;
// Language attribute key
protected
$lang_id
=
'lang'
;
// Pods instance
protected
$pods
;
// Posts container in WP
protected
$podsType
=
'job'
;
// Additional post fields
protected
$postProperties
=
[
'post_status'
=>
'publish'
,
'comment_status'
=>
'closed'
];
public
function
__construct
(
$data
)
{
$this
->
data
=
$data
;
$this
->
setPods
();
}
/**
* Set Pods instance
*/
private
function
setPods
()
{
$this
->
pods
=
pods
(
$this
->
podsType
);
}
/**
* Transform data keys by relations mapping
*
* @param array $data Data array
*
* @param array $relationsMap
*
* @return array
*/
private
function
mapRelations
(
$data
,
$relationsMap
=
[])
{
foreach
(
$relationsMap
as
$relationKey
=>
$dataKey
)
{
if
(
array_key_exists
(
$dataKey
,
$data
))
{
$data
[
$relationKey
]
=
$data
[
$dataKey
];
unset
(
$data
[
$dataKey
]);
}
}
return
$data
;
}
/**
* Import posts from provided data: if post with given Id exists, it rewrites
*/
public
function
import
()
{
global
$permalink_manager_uris
;
foreach
(
$this
->
data
as
$ad
)
{
// Set language code
$lang
=
$this
->
getAdLang
(
$ad
);
// Set relations mapping
$relations
=
$ad
[
'relations'
];
// Set related taxonomies
$terms
=
$this
->
getTerms
(
$ad
[
'terms'
],
$lang
);
// Set related custom posts
$posts
=
$this
->
getPosts
(
$ad
[
'posts'
],
$lang
);
// Collect and prepare job's data
$adData
=
$this
->
mapRelations
(
array_merge
(
$ad
[
'properties'
],
[
'lang'
=>
$lang
],
$terms
,
$posts
,
$this
->
postProperties
),
$relations
);
// if ($ad['properties'][$this->primaryKey] == 14531) {
//
// var_dump($ad);
// var_dump($adData);
// }
// Unique key of post
$primaryKey
=
$adData
[
$this
->
primaryKey
];
$pod
=
$this
->
getPod
(
$primaryKey
);
if
(
$pod
->
total_found
()
>
0
)
{
try
{
$podId
=
$pod
->
save
(
$adData
);
// Set post language
$this
->
setPostLang
(
$podId
,
$ad
[
'lang'
]);
print_r
(
"Old record (
$this->primaryKey
:
$primaryKey
) has been updated. <br>"
);
}
catch
(
Exception
$e
)
{
print_r
(
"Error while updating record (
$this->idKey
:
$primaryKey
). Error:
$e->getMessage
()<br>"
);
}
}
else
{
try
{
$podId
=
$this
->
pods
->
add
(
$adData
);
// Set post language
$this
->
setPostLang
(
$podId
,
$ad
[
'lang'
]);
$this
->
getPod
(
$primaryKey
)
->
save
(
$adData
);
// Save related data, cause didn't saved on creation
print_r
(
"New record (
$this->primaryKey
:
$primaryKey
) has been created. <br>"
);
}
catch
(
Exception
$e
)
{
print_r
(
"Error while creating record (
$this->primaryKey
:
$primaryKey
). Error:
$e->getMessage
()<br>"
);
}
}
}
}
/**
* Get taxonomies Id's
*
* @param array $terms Data array
* @param string $lang Language code
*
* @return array
*/
private
function
getTerms
(
$terms
,
$lang
)
{
$result
=
[];
foreach
(
$terms
as
$termKey
=>
$termData
)
{
$slug
=
$this
->
getSlug
(
$termKey
,
$termData
,
$lang
);
$result
[
$termKey
]
=
$this
->
getTerm
(
$termKey
,
$slug
,
$termData
[
'name'
],
$lang
);
}
return
$result
;
}
/**
* Get custom posts Id's
*
* @param $posts array Data array
* @param $lang string Language code
*
* @return array
*/
private
function
getPosts
(
$posts
,
$lang
)
{
$result
=
[];
foreach
(
$posts
as
$postKey
=>
$postData
)
{
$result
[
$postKey
]
=
$this
->
getPost
(
$postKey
,
$postData
,
$lang
);
}
return
$result
;
}
/**
* Return formated slug
*
* @param string $key Object key name
* @param array $data Object data
* @param string $lang Language code
*
* @return string Slug
*/
private
function
getSlug
(
$key
,
$data
,
$lang
)
{
if
(
isset
(
$data
[
'slug'
]))
{
return
$key
.
'-'
.
$data
[
'slug'
]
.
'-'
.
$lang
;
}
return
$data
[
'name'
]
.
'-'
.
$lang
;
}
/**
* Find and return taxonomy id, if not exist, create it
*
* @param string $key Taxonomy key name
* @param string $slug Taxonomy slug0
* @param string $value Taxonomy name
* @param string $lang Taxonomy language code
*
* @return int Taxonomy id
*/
private
function
getTerm
(
$key
,
$slug
,
$value
,
$lang
)
{
$term
=
pods
(
$key
,
$slug
);
if
(
!
$term
->
exists
())
{
try
{
$termId
=
pods
(
$key
)
->
add
([
'name'
=>
$value
,
'slug'
=>
$slug
,
]);
}
catch
(
Exception
$e
)
{
print_r
(
"Error while creating taxonomies (
$key
=>
$slug
). Error:
$e->getMessage
()<br>"
);
}
}
else
{
try
{
$termId
=
$term
->
save
([
'name'
=>
$value
,
'slug'
=>
$slug
,
]);
}
catch
(
Exception
$e
)
{
print_r
(
"Error while updating taxonomies (
$key
=>
$slug
). Error:
$e->getMessage
()<br>"
);
}
}
if
(
empty
(
$termId
))
{
return
false
;
}
$this
->
setTermLang
(
$termId
,
$lang
);
return
$termId
;
}
/**
* Get custom post Id, if post not exists, creates it
*
* @param string $key Post key name
* @param array $data Post data array
* @param string $lang Post language code
*
* @return int Post Id
*/
private
function
getPost
(
$key
,
$data
,
$lang
)
{
$slug
=
$this
->
getSlug
(
$key
,
$data
,
$lang
);
$post
=
pods
(
$key
,
$slug
);
if
(
!
$post
->
exists
())
{
try
{
$postId
=
pods
(
$key
)
->
add
(
array_merge
(
$data
,
[
'slug'
=>
$slug
],
$this
->
postProperties
)
);
}
catch
(
Exception
$e
)
{
print_r
(
"Error while creating custom post (
$key
=>
$slug
). Error:
$e->getMessage
()<br>"
);
}
}
else
{
try
{
$postId
=
$post
->
save
(
array_merge
(
$data
,
[
'slug'
=>
$slug
],
$this
->
postProperties
)
);
}
catch
(
Exception
$e
)
{
print_r
(
"Error while updating custom post (
$key
=>
$slug
). Error:
$e->getMessage
()<br>"
);
}
}
if
(
empty
(
$postId
))
{
return
false
;
}
$this
->
setPostLang
(
$postId
,
$lang
);
return
$postId
;
}
/**
* Set language param for given pod, using Polylang library
*
* @param $postId
* @param $lang
*/
private
function
setPostLang
(
$postId
,
$lang
)
{
try
{
PLL
()
->
model
->
post
->
set_language
(
$postId
,
$lang
);
print_r
(
"Set language code '
$lang
' for custom post (id:
$postId
). <br>"
);
}
catch
(
Exception
$e
)
{
print_r
(
"Error while setting language code for custom post (id:
$postId
), error:
$e->getMessage
().<br>"
);
}
}
/**
* Set language param for given taxonomy, using Polylang library
*
* @param $termId
* @param $lang
*/
private
function
setTermLang
(
$termId
,
$lang
)
{
try
{
PLL
()
->
model
->
term
->
set_language
(
$termId
,
$lang
);
print_r
(
"Set language code '
$lang
' for taxonomy (id:
$termId
). <br>"
);
}
catch
(
Exception
$e
)
{
print_r
(
"Error while setting language code for taxonomy (id:
$termId
), error:
$e->getMessage
().<br>"
);
}
}
/**
* Get pod by given id
*
* @param $id
*
* @return mixed
*/
private
function
getPod
(
$id
)
{
$params
=
[
'where'
=>
[
'relation'
=>
'AND'
,
[
'value'
=>
(
int
)
$id
,
'key'
=>
$this
->
primaryKey
,
'compare'
=>
'='
,
]
]
];
return
$this
->
pods
->
find
(
$params
);
}
/**
* Get language code from advert data
*
* @param array $ad
*
* @return string`
*/
private
function
getAdLang
(
$ad
)
{
return
$ad
[
$this
->
lang_id
];
}
}
wp-content/plugins/jobs-importer/jobs-importer.php
0 → 100644
View file @
f98ebdf6
<?php
/*
Plugin Name: Biuro Jobs importer
description: A plugin for import jobs ads from Biuro endpoint
Version: 1.0.0
*/
set_time_limit
(
300
);
// Data collector: prepare data for import
require_once
'JsonDataCollector.php'
;
// Data importer: imports data to WP posts
require_once
'JobsImporter.php'
;
if
(
function_exists
(
'importer_admin_menu'
))
{
// Add item to admin menu
add_action
(
'admin_menu'
,
'importer_admin_menu'
);
}
/**
* Set admin menu item for plugin
*/
function
importer_admin_menu
()
{
add_submenu_page
(
'options-general.php'
,
'Biuro Jobs importer'
,
'Biuro Jobs importer'
,
'data_importer'
,
'jobs-importer'
,
'do_import'
);
}
/**
* Imports posts from Biuro endpoint
*/
function
do_import
()
{
// Set environment type
$env
=
'prod'
;
//Set dev env. only on dev subdomain
$subDomain
=
strstr
(
$_SERVER
[
'SERVER_NAME'
],
'.biuro.lt'
,
true
);
if
(
$subDomain
==
'dev'
)
{
$env
=
'dev'
;
}
// Set data source path by environment type
if
(
$env
===
'dev'
)
{
// $inputFile = plugin_dir_path(__FILE__) . "source_data/wp_biuro.php.xml";
$inputFile
=
"https://base.biuro.lt/_export/wp_biuro.php"
;
}
elseif
(
$env
===
'prod'
)
{
$inputFile
=
"http://export.biuro.lt/wp_biuro.php"
;
}
print_r
(
"<div style='background: lightgrey;'>
<small style='float: right;'>Working in <strong>
$env
</strong> mode</small>
<div style='clear: both;'></div>
</div>"
);
echo
"<pre>"
;
print_r
(
'<h4>Biuro Jobs importer</h4>'
);
// if (pll_current_language() != '')
// {
// print_r("<h5 class='warning'>Polylang must be set in 'All languages' mode.</h5>");
// pll_the_languages( array( 'dropdown' => 1 ) );
// exit();
// }
print_r
(
"Data source:
$inputFile
<br><br>"
);
// JSON reader
$ads
=
(
new
JsonDataCollector
(
$inputFile
))
->
getData
();
print_r
(
"Found "
.
count
(
$ads
)
.
" ads from Biuro.<br>"
);
if
(
count
(
$ads
)
>
0
)
{
if
(
empty
(
$_POST
))
{
// Form for import start, set polylang to 'All lang.' for action
print_r
(
"<form method='post' action='"
.
current_location
()
.
"&lang=all'>"
);
print_r
(
"<div style='margin-top: 10px;'><button name='import' value='true'>Import</button></div>"
);
print_r
(
"</form>"
);
}
// for cron, needs add to url ...&lang=all&proceed=1
if
(
isset
(
$_POST
[
'import'
])
||
isset
(
$_GET
[
'proceed'
]))
{
print_r
(
"importing....<br><br>"
);
// Posts (via Pods framework) creator
(
new
JobsImporter
(
$ads
))
->
import
();
}
}
else
{
print_r
(
"<br>There is nothing more to do."
);
}
echo
"</pre>"
;
}
function
current_location
()
{
if
(
isset
(
$_SERVER
[
'HTTPS'
])
&&
(
$_SERVER
[
'HTTPS'
]
==
'on'
||
$_SERVER
[
'HTTPS'
]
==
1
)
||
isset
(
$_SERVER
[
'HTTP_X_FORWARDED_PROTO'
])
&&
$_SERVER
[
'HTTP_X_FORWARDED_PROTO'
]
==
'https'
)
{
$protocol
=
'https://'
;
}
else
{
$protocol
=
'http://'
;
}
return
$protocol
.
$_SERVER
[
'HTTP_HOST'
]
.
$_SERVER
[
'REQUEST_URI'
];
}
\ No newline at end of file
wp-content/themes/biuro/_unused_footer-job.php
deleted
100644 → 0
View file @
02f58cef
</div>
<!-- #custom -->
</div>
<!-- .container -->
</div>
<!-- .advert_page -->
<?php
/*
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-THF42F"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-THF42F');</script>
*/
if
(
is_active_sidebar
(
'append_area'
)
)
:
dynamic_sidebar
(
'append_area'
);
endif
;
?>
<!-- <script src="/wp-content/themes/biuro/js/main-bd2575b3.min.js" async></script> -->
</body>
</html>
wp-content/themes/biuro/_unused_header-job.php
deleted
100644 → 0
View file @
02f58cef
<!DOCTYPE html>
<html
<?php
language_attributes
();
?>
>
<head>
<meta
charset=
"
<?php
bloginfo
(
'charset'
);
?>
"
>
<meta
content=
"IE=edge,chrome=1"
http-equiv=
"X-UA-Compatible"
/>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, shrink-to-fit=no"
>
<link
rel=
"apple-touch-icon"
sizes=
"180x180"
href=
"/apple-touch-icon.png"
>
<link
rel=
"icon"
type=
"image/png"
sizes=
"32x32"
href=
"/favicon-32x32.png"
>
<link
rel=
"icon"
type=
"image/png"
sizes=
"16x16"
href=
"/favicon-16x16.png"
>
<link
rel=
"manifest"
href=
"/site.webmanifest"
>
<link
rel=
"mask-icon"
href=
"/safari-pinned-tab.svg"
color=
"#006957"
>
<meta
name=
"msapplication-TileColor"
content=
"#ffffff"
>
<meta
name=
"theme-color"
content=
"#ffffff"
>
<meta
name=
"google-site-verification"
content=
"Xlpzg6WVpXXrivwjXrOaEzjxZQcPP2x0oCoUizYyCDM"
/>
<link
rel=
"profile"
href=
"http://gmpg.org/xfn/11"
>
<link
rel=
"pingback"
href=
"
<?php
bloginfo
(
'pingback_url'
);
?>
"
>
<style>
<?php
include
'css/core-69d6ceb7cb.min.css'
;
?>
</style>
<link
rel=
"preload"
href=
"/wp-content/themes/biuro/css/main-35c949f725.min.css"
as=
"style"
onload=
"this.rel='stylesheet'"
>
<noscript>
<link
rel=
"stylesheet"
href=
"/wp-content/themes/biuro/css/main-35c949f725.min.css"
>
</noscript>
<?php
wp_head
();
?>
</head>
<body>
<svg
xmlns=
"http://www.w3.org/2000/svg"
class=
"u-hidden"
>
<symbol
id=
"biuro-logo"
viewBox=
"0 0 108 63"
aria-labelledby=
"svg-title svg-desc"
>
<title
id=
"svg-title"
>
Biuro
</title>
<desc
id=
"svg-desc"
>
<?php
echo
get_the_title
(
get_option
(
'page_on_front'
)
);
?>
</desc>
<path
d=
"M12.91 39.688L11.1 39.686v11.7h1.809c0.375 0 0.693-0.131 0.959-0.396 c0.264-0.263 0.398-0.584 0.398-0.962v-8.984c0-0.375-0.134-0.695-0.398-0.963C13.603 39.8 13.3 39.7 12.9 39.688z M63.684 23.92h-1.809v11.358h1.809c0.376 0 0.696-0.132 0.96-0.396c0.264-0.261 0.396-0.583 0.396-0.96v-8.645 c0-0.378-0.133-0.698-0.396-0.961C64.38 24.1 64.1 23.9 63.7 23.92z M12.91 23.92H11.1v9.608h1.809 c0.375 0 0.693-0.133 0.959-0.398c0.264-0.263 0.398-0.583 0.398-0.958v-6.896c0-0.378-0.134-0.698-0.398-0.961 C13.603 24.1 13.3 23.9 12.9 23.92z M107.216 7.496c-0.907-1.476-3.211-2.783-5.211-1.261l-12.774 9.1 c-0.426 0.014-0.844-0.206-1.058-0.607c-0.122-0.231-0.15-0.481-0.113-0.719l4.428-7.936c0.695-1.001 0.869-1.489 0.869-2.434 c0-1.856-1.621-3.525-3.477-3.525c-0.26 0-0.673-0.127-0.916-0.07H4.752C2.127 0 0 2.1 0 4.766V57.5 c0 2.6 2.1 4.8 4.8 4.752h98.176c2.627 0 4.753-2.128 4.753-4.752V8.919C107.641 8.4 107.5 8 107.2 7.496z M38.126 9.543c1.664 0 3 1.4 3 3.019c0 1.665-1.351 3.015-3.015 3.015c-1.666 0-3.017-1.35-3.017-3.015 C35.109 10.9 36.5 9.5 38.1 9.543z M27.623 9.543c1.666 0 3 1.4 3 3.019c0 1.665-1.352 3.015-3.018 3 c-1.665 0-3.017-1.35-3.017-3.015C24.606 10.9 26 9.5 27.6 9.543z M20.876 30.647c0 1.732-0.528 3.182-1.581 4.3 c-0.567 0.602-1.242 1.093-2.035 1.471c0.828 0.3 1.5 0.7 2 1.242c0.528 0.5 0.9 1.1 1.2 1.9 c0.263 0.7 0.4 1.5 0.4 2.371v8.365c0 0.98-0.188 1.901-0.564 2.768c-0.377 0.867-0.885 1.622-1.526 2.3 c-0.642 0.642-1.392 1.151-2.259 1.528c-0.867 0.374-1.792 0.564-2.769 0.564H5.28c-0.527 0-0.79-0.265-0.79-0.792V18.664 c0-0.525 0.262-0.79 0.79-0.79h8.478c0.976 0 1.9 0.2 2.8 0.565c0.867 0.4 1.6 0.9 2.3 1.5 c0.642 0.6 1.1 1.4 1.5 2.261c0.377 0.9 0.6 1.8 0.6 2.77V30.647z M31.067 56.193c0 0.529-0.264 0.792-0.789 0.8 h-5.031c-0.529 0-0.791-0.263-0.791-0.792V18.654c0-0.529 0.262-0.791 0.791-0.791h5.031c0.525 0 0.8 0.3 0.8 0.791V56.193z M51.261 50.706c0 0.981-0.189 1.904-0.566 2.77c-0.377 0.866-0.884 1.62-1.524 2.261c-0.645 0.64-1.396 1.148-2.261 1.5 c-0.868 0.374-1.792 0.563-2.771 0.563h-2.145c-0.982 0-1.907-0.189-2.771-0.563c-0.867-0.378-1.619-0.887-2.258-1.526 c-0.643-0.641-1.151-1.395-1.526-2.261c-0.377-0.865-0.566-1.788-0.566-2.77v-21.23c-0.005-0.054-0.022-0.1-0.022-0.157V18.654 c0-0.529 0.264-0.791 0.791-0.791h5.03c0.527 0 0.8 0.3 0.8 0.791v10.082c0.008 0 0 0.1 0 0.146v21.542 c0 0.4 0.1 0.7 0.4 0.962c0.262 0.3 0.6 0.4 1 0.395h0.453c0.375 0 0.697-0.13 0.961-0.395 c0.261-0.265 0.393-0.585 0.393-0.962V18.836c0-0.526 0.264-0.791 0.793-0.791h5.029c0.527 0 0.8 0.3 0.8 0.791V50.706z M72.216 57.433h-5.142c-0.225 0-0.442-0.077-0.65-0.227c-0.208-0.15-0.35-0.337-0.425-0.565l-4.125-13.845v14.637l-0.055-0.564 c-0.078 0.374-0.321 0.564-0.735 0.564h-5.031c-0.527 0-0.791-0.262-0.791-0.792V18.664c0-0.525 0.264-0.79 0.791-0.79h8.478 c0.979 0 1.9 0.2 2.8 0.565c0.867 0.4 1.6 0.9 2.3 1.524c0.641 0.6 1.1 1.4 1.5 2.3 c0.377 0.9 0.6 1.8 0.6 2.77v9.212c0 1.393-0.359 2.647-1.074 3.757c-0.718 1.111-1.657 1.97-2.826 2.572l5.029 16.1 C72.896 57.2 72.7 57.4 72.2 57.433z M91.941 50.706c0 0.981-0.188 1.904-0.565 2.77c-0.379 0.866-0.883 1.62-1.528 2.3 c-0.64 0.64-1.393 1.148-2.259 1.526c-0.864 0.374-1.79 0.563-2.769 0.563h-2.147c-0.979 0-1.904-0.189-2.769-0.563 c-0.869-0.378-1.621-0.887-2.261-1.526c-0.641-0.641-1.15-1.395-1.523-2.261c-0.379-0.865-0.566-1.788-0.566-2.77V24.598 c0-0.979 0.188-1.901 0.566-2.767c0.373-0.867 0.883-1.62 1.523-2.263c0.64-0.639 1.392-1.147 2.261-1.524 c0.864-0.377 1.789-0.565 2.769-0.565h2.147c0.979 0 1.9 0.2 2.8 0.565c0.866 0.4 1.6 0.9 2.3 1.5 c0.645 0.6 1.1 1.4 1.5 2.263c0.377 0.9 0.6 1.8 0.6 2.767V50.706z M83.972 23.525h-0.453 c-0.377 0-0.696 0.134-0.959 0.396c-0.265 0.264-0.396 0.585-0.396 0.961v25.543c0 0.4 0.1 0.7 0.4 1 c0.263 0.3 0.6 0.4 1 0.395h0.453c0.376 0 0.695-0.13 0.96-0.395c0.266-0.265 0.396-0.585 0.396-0.962V24.881 c0-0.376-0.131-0.697-0.396-0.961C84.668 23.7 84.3 23.5 84 23.525z"
style=
"fill: #006957"
/>
</symbol>
</svg>
<div
class=
"advert_page"
>
<div
class=
"container"
>
<div
id=
"custom"
>
wp-content/themes/biuro/page-jobs.php
deleted
100644 → 0
View file @
02f58cef
<?php
/**
* Template Name: Jobs listing
*
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* E.g., it puts together the home page when no home.php file exists.
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package WordPress
* @subpackage Biuro
* @since 1.0
* @version 1.0
*/
get_header
();
?>
<?php
while
(
have_posts
()
)
:
the_post
();
the_content
();
endwhile
;
?>
<?php
$ID
=
get_the_ID
();
$keys
=
get_post_custom_keys
();
// $where = 'valid.meta_value > "' . date('Y-m-d', strtotime('-1 days')) . '"';
$where
=
'valid.meta_value > "'
.
date
(
'Y-m-d'
,
strtotime
(
'-1 days'
))
.
'" AND (t.post_title LIKE "%'
.
searchQuery
.
'%" OR t.post_content LIKE "%'
.
searchQuery
.
'%")'
;
$taxonomies
=
array
();
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
;
}
$term
=
$res
[
0
];
if
(
!
$term
)
{
continue
;
}
$where
=
$where
.
' AND '
.
$taxonomy
.
'.slug = "'
.
$term
.
'"'
;
}
$params
=
array
(
'orderby'
=>
'date DESC'
,
'where'
=>
$where
,
'limit'
=>
21
);
$jobs
=
pods
(
'job'
,
$params
);
if
(
0
<
$jobs
->
total
()
)
:
get_template_part
(
'template-parts/jobs/jobs'
,
'list'
);
else
:
get_template_part
(
'template-parts/jobs/jobs'
,
'not-found'
);
endif
;
?>
<?php
get_footer
();
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