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
d8cb3c33
Commit
d8cb3c33
authored
Feb 15, 2019
by
Simonas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Search page update
parent
4d401190
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
226 additions
and
9 deletions
+226
-9
_unused_page-jobs.php
wp-content/themes/biuro/_unused_page-jobs.php
+10
-0
footer.php
wp-content/themes/biuro/footer.php
+2
-1
functions.php
wp-content/themes/biuro/functions.php
+25
-5
header.php
wp-content/themes/biuro/header.php
+16
-2
index.php
wp-content/themes/biuro/index.php
+3
-0
search.php
wp-content/themes/biuro/search.php
+164
-0
searchform.php
wp-content/themes/biuro/searchform.php
+6
-1
No files found.
wp-content/themes/biuro/page-jobs.php
→
wp-content/themes/biuro/
_unused_
page-jobs.php
View file @
d8cb3c33
...
...
@@ -28,6 +28,16 @@ get_header(); ?>
<?php
// global $query_string;
// wp_parse_str( $query_string, $search_query );
// $search = new WP_Query( $search_query );
// debug( $query_string );
// debug( $search_query );
// debug( $search );
$ID
=
get_the_ID
();
$keys
=
get_post_custom_keys
();
...
...
wp-content/themes/biuro/footer.php
View file @
d8cb3c33
</main>
<!-- .l-main -->
<?php
if
(
!
searchQuery
&&
!
cityID
&&
get_post_type
()
==
'job'
)
:
if
(
!
is_search
()
&&
get_post_type
()
==
'job'
)
:
?>
<aside
class=
"l-aside"
>
<?php
...
...
wp-content/themes/biuro/functions.php
View file @
d8cb3c33
...
...
@@ -284,11 +284,31 @@ add_action('init', 'df_disable_comments_admin_bar');
$l
=
get_nav_menu_locations
();
$m
=
$l
?
wp_get_nav_menu_object
(
$l
[
'main-menu'
]
)
:
null
;
$items
=
$m
?
wp_get_nav_menu_items
(
$m
->
term_id
,
array
(
'order'
=>
'DESC'
)
)
:
array
();
//
$l = get_nav_menu_locations();
//
$m = $l ? wp_get_nav_menu_object( $l[ 'main-menu' ] ) : null;
//
$items = $m ? wp_get_nav_menu_items( $m->term_id, array( 'order' => 'DESC' ) ) : array();
$searchPageURL
=
$items
[
0
]
?
$items
[
0
]
->
url
:
'/'
;
// $searchPageURL = $items[0] ? $items[0]->url : '/';
// global $searchPageURL;
// $searchPage = new WP_Query( array(
// 'numberposts' => 1,
// 'post_type' => 'page',
// 'meta_key' => 'search-page',
// 'meta_value' => 'true'
// ) );
// if ( $searchPage->have_posts() ) :
// while( $searchPage->have_posts() ) :
// $searchPage->the_post();
// $searchPageURL = get_the_permalink();
// endwhile;
// else:
// $searchPageURL = '/';
// endif;
// delog( $searchPageURL );
// require_once 'includes/disable_discussion';
...
...
wp-content/themes/biuro/header.php
View file @
d8cb3c33
...
...
@@ -58,7 +58,6 @@ $section = get_post_meta( $post->ID, 'section', true );
?>
<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>
...
...
@@ -94,9 +93,24 @@ $section = get_post_meta( $post->ID, 'section', true );
?>
</div>
<div
class=
"l-inner"
>
<?php
/*
delog( get_search_query(), 'Search Query');
delog( get_post_type(), 'Post type');
delog( get_page_template_slug(), 'slug');
delog( is_front_page(), 'is_front_page');
delog( is_search(), 'is_search');
*/
?>
</div>
<div
id=
"main"
class=
"l-content"
>
<?php
if
(
!
is_front_page
()
&&
get_post_type
()
==
'page'
&&
get_page_template_slug
()
==
'page-jobs.php'
||
is_search
()
)
:
// if ( !is_front_page() && get_post_type() == 'page' && get_page_template_slug() == 'search.php' || is_search() ):
if
(
get_page_template_slug
()
==
'search.php'
||
is_search
()
)
:
?>
<aside
class=
"l-aside"
>
<?php
...
...
wp-content/themes/biuro/index.php
View file @
d8cb3c33
...
...
@@ -17,6 +17,9 @@
get_header
();
?>
<h1>
index.php
</h1>
<?php
if
(
is_search
()
)
:
?>
...
...
wp-content/themes/biuro/search.php
0 → 100644
View file @
d8cb3c33
<?php
/**
*
get_header(); ?>
<?php
global $query_string;
$query_args = explode("&", $query_string);
debug( $query_args );
$search_query = array();
foreach($query_args as $key => $string) {
$query_split = explode("=", $string);
$search_query[$query_split[0]] = urldecode($query_split[1]);
} // foreach
debug( $search_query );
$the_query = new WP_Query($search_query);
// $query = new WP_Query( array( 'author_name' => 'carlo' ) );
// $args = array(
// 'post_type' => 'accommodation',
// 'meta_query' => array(
// array( 'key' => 'city', 'value' => 'Paris', 'compare' => 'LIKE' ),
// array( 'key' => 'type', 'value' => 'room', 'compare' => 'LIKE' ),
// 'relation' => 'AND'
// )
// );
// $the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) :
?>
<!-- the loop -->
<h1>Lorem ipsum - Search</h1>
<ul>
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<li>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</li>
<?php endwhile; ?>
</ul>
<!-- end of the loop -->
<?php wp_reset_postdata(); ?>
<?php else : ?>
<h1>Lorem ipsum - Search</h1>
<p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
<?php endif; ?>
<?php get_footer();
*/
?>
<?php
/**
* Template Name: Search & Jobs page
*
* 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
if
(
!
is_search
()
)
:
while
(
have_posts
()
)
:
the_post
();
the_content
();
endwhile
;
endif
;
?>
<?php
global
$query_string
;
$ID
=
get_the_ID
();
$keys
=
get_post_custom_keys
();
$where
=
'valid.meta_value > "'
.
date
(
'Y-m-d'
,
strtotime
(
'-1 days'
))
.
'"'
;
if
(
is_search
()
)
:
wp_parse_str
(
$query_string
,
$searchQuery
);
if
(
$searchQuery
)
:
if
(
$searchQuery
[
'city'
]
)
:
$where
=
$where
.
' AND city.term_id = '
.
$searchQuery
[
'city'
];
endif
;
if
(
$searchQuery
[
's'
]
)
:
$where
=
$where
.
' AND (t.post_title LIKE "%'
.
$searchQuery
[
's'
]
.
'%" OR t.post_content LIKE "%'
.
$searchQuery
[
's'
]
.
'%")'
;
endif
;
endif
;
// $where = 'valid.meta_value > "' . date('Y-m-d', strtotime('-1 days')) . '" AND (t.post_title LIKE "%' . $searchQuery . '%" OR t.post_content LIKE "%' . $searchQuery . '%")';
elseif
(
$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
;
$where
=
$where
.
' AND '
.
$taxonomy
.
'.slug = "'
.
$term
.
'"'
;
endforeach
;
endif
;
$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
();
wp-content/themes/biuro/searchform.php
View file @
d8cb3c33
...
...
@@ -8,9 +8,14 @@
* @version 1.0
*/
// global $searchPageURL;
?>
<form
class=
"c-search"
action=
"
<?php
echo
pll_home_url
();
?>
"
method=
"get"
>
<?php
/*
<form class="c-search" action="<?php echo $searchPageURL; ?>" method="get">
*/
?>
<form
class=
"c-search"
action=
"
<?php
echo
home_url
();
?>
"
method=
"get"
>
<?php
...
...
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