Commit 53aae2ea authored by Simonas's avatar Simonas

SEO fixes in progress

parent 65038724
...@@ -105,8 +105,8 @@ services: ...@@ -105,8 +105,8 @@ services:
- ./wordpress:/var/www/html - ./wordpress:/var/www/html
- './wp-init.sh:/usr/local/bin/wp-init.sh' - './wp-init.sh:/usr/local/bin/wp-init.sh'
# command: command:
# - wp-init.sh - wp-init.sh
networks: networks:
front: front:
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
// https://pods.io/docs/code/pods/find/ // https://pods.io/docs/code/pods/find/
$where = 'valid.meta_value > "' . date('Y-m-d', strtotime('-1 days')) . '"'; $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 "%' . $search . '%"'; // $where = 'valid.meta_value > "' . date('Y-m-d', strtotime('-1 days')) . '" AND (t.post_title LIKE "%' . searchQuery . '%" OR t.post_content LIKE "%' . searchQuery . '%")';
$params = array( $params = array(
'orderby' => 'date DESC', 'orderby' => 'date DESC',
......
...@@ -6,6 +6,10 @@ function debug($arr) { ...@@ -6,6 +6,10 @@ function debug($arr) {
echo '</pre>'; echo '</pre>';
} }
function delog($str, $label = 'Label') {
echo '<h1 style="white-space: nowrap;">' . $label . ': ' . $str . '</h1>';
}
function cc_mime_types($mimes) { function cc_mime_types($mimes) {
$mimes['svg'] = 'image/svg+xml'; $mimes['svg'] = 'image/svg+xml';
...@@ -225,6 +229,8 @@ function init_biuro_theme() { ...@@ -225,6 +229,8 @@ function init_biuro_theme() {
pll_register_string('biuro-language', 'Language', 'Biuro'); pll_register_string('biuro-language', 'Language', 'Biuro');
pll_register_string('biuro-next', 'Next ', 'Biuro'); pll_register_string('biuro-next', 'Next ', 'Biuro');
pll_register_string('biuro-previous', 'Previous', 'Biuro'); pll_register_string('biuro-previous', 'Previous', 'Biuro');
pll_register_string('biuro-home', 'Home page', 'Biuro');
endif; endif;
} }
add_action('init', 'init_biuro_theme'); add_action('init', 'init_biuro_theme');
......
<!DOCTYPE html> <?php
$searchQuery = get_search_query();
$cityID = get_query_var('city');
$cityID = is_numeric($cityID) ? $cityID : '';
define('searchQuery', $searchQuery);
define('cityID', $cityID);
?><!DOCTYPE html>
<html <?php language_attributes(); ?>> <html <?php language_attributes(); ?>>
<head> <head>
<meta charset="<?php bloginfo( 'charset' ); ?>"> <meta charset="<?php bloginfo( 'charset' ); ?>">
...@@ -66,22 +75,15 @@ ...@@ -66,22 +75,15 @@
<div class="l-inner" style="box-shadow: inset 0 0 0 1px blue; padding: 1em 0;"> <div class="l-inner" style="box-shadow: inset 0 0 0 1px blue; padding: 1em 0;">
<?php <?php
/*
<h1><?php echo get_post_type(); ?></h1>
*/
get_search_form(); get_search_form();
?>
<?php get_template_part( 'template-parts/layout/breadcrumb' );
// https://torquemag.io/2017/10/add-breadcrumbs-wordpress-website/
if ( function_exists('yoast_breadcrumb') && !is_front_page() ) {
yoast_breadcrumb('<div class="c-breadcrumbs"><a href="' . pll_home_url() . '">' . get_the_title( get_option('page_on_front') ) . '</a> › ','</div>');
}
?> ?>
</div> </div>
<div id="main" class="l-content"> <div id="main" class="l-content">
<?php <?php
if (get_post_type() == 'job'): if ( !searchQuery && !cityID && get_post_type() == 'job' ):
?> ?>
<aside class="l-aside"> <aside class="l-aside">
<?php <?php
...@@ -92,3 +94,5 @@ ...@@ -92,3 +94,5 @@
endif; endif;
?> ?>
<main id="content" class="l-main"> <main id="content" class="l-main">
...@@ -15,11 +15,6 @@ ...@@ -15,11 +15,6 @@
* @version 1.0 * @version 1.0
*/ */
$search = get_query_var('s');
$cityID = get_query_var('city');
$cityID = is_numeric($cityID) ? $cityID : '';
get_header(); ?> get_header(); ?>
<?php <?php
...@@ -30,11 +25,11 @@ get_header(); ?> ...@@ -30,11 +25,11 @@ get_header(); ?>
// Use for search // Use for search
// https://pods.io/docs/code/pods/find/ // https://pods.io/docs/code/pods/find/
$where = 'valid.meta_value > "' . date('Y-m-d', strtotime('-1 days')) . '" AND t.post_title LIKE "%' . $search . '%"'; // $where = 'valid.meta_value > "' . date('Y-m-d', strtotime('-1 days')) . '" AND t.post_title LIKE "%' . $searchQuery . '%"';
// 'where' => 't.post_title LIKE "%' . $keyword . '%" OR my_field.meta_value LIKE "%' . $keyword . '%"' $where = 'valid.meta_value > "' . date('Y-m-d', strtotime('-1 days')) . '" AND (t.post_title LIKE "%' . searchQuery . '%" OR t.post_content LIKE "%' . searchQuery . '%")';
if ($cityID): if (cityID):
$where = $where . ' AND city.term_id = ' . $cityID; $where = $where . ' AND city.term_id = ' . cityID;
endif; endif;
$params = array( $params = array(
...@@ -51,7 +46,7 @@ get_header(); ?> ...@@ -51,7 +46,7 @@ get_header(); ?>
else: else:
get_template_part( 'template-parts/jobs/jobs', 'none' ); get_template_part( 'template-parts/jobs/jobs', 'not-found' );
endif; endif;
?> ?>
......
...@@ -31,7 +31,8 @@ get_header(); ?> ...@@ -31,7 +31,8 @@ get_header(); ?>
$ID = get_the_ID(); $ID = get_the_ID();
$keys = get_post_custom_keys(); $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')) . '"';
$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(); $taxonomies = array();
...@@ -72,7 +73,7 @@ get_header(); ?> ...@@ -72,7 +73,7 @@ get_header(); ?>
else: else:
get_template_part( 'template-parts/jobs/jobs', 'none' ); get_template_part( 'template-parts/jobs/jobs', 'not-found' );
endif; endif;
?> ?>
......
...@@ -8,10 +8,6 @@ ...@@ -8,10 +8,6 @@
* @version 1.0 * @version 1.0
*/ */
$search = get_query_var('s');
$cityID = get_query_var('city');
$cityID = is_numeric($cityID) ? $cityID : '';
?> ?>
<form class="c-search" action="<?php echo pll_home_url(); ?>" method="get"> <form class="c-search" action="<?php echo pll_home_url(); ?>" method="get">
...@@ -56,9 +52,9 @@ ...@@ -56,9 +52,9 @@
endif; endif;
?> ?>
</datalist> </datalist>
<input list="search-cities" id="search-city" name="city" value="<?php echo $cityID; ?>" placeholder="" /> <input list="search-cities" id="search-city" name="city" value="<?php echo cityID; ?>" placeholder="" />
<input type="text" name="s" id="search" value="<?php echo $search; ?>" /> <input type="text" name="s" id="search" value="<?php echo searchQuery; ?>" />
<input type="submit" value="Ieškoti" class="filter-button" /> <input type="submit" value="Ieškoti" class="filter-button" />
<a href="<?php echo pll_home_url(); ?>" class="filter-button"><?php pll_e('Clear'); ?></a> <a href="<?php echo pll_home_url(); ?>" class="filter-button"><?php pll_e('Clear'); ?></a>
......
...@@ -11,4 +11,4 @@ ...@@ -11,4 +11,4 @@
?> ?>
<p>Pagal Jūsų paiešką rezultatų neradome.</p> <p>Darbo skelbimų nėra.</p>
<?php
/**
* Template part for displaying a message that jobs cannot be found
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package WordPress
* @subpackage Twenty_Nineteen
* @since 1.0.0
*/
?>
<p>Pagal Jūsų paiešką rezultatų neradome.</p>
<?php
// https://torquemag.io/2017/10/add-breadcrumbs-wordpress-website/
if ( !function_exists('yoast_breadcrumb') || is_front_page() || searchQuery) :
return;
endif;
if ( cityID ) :
$page = get_term_meta( cityID, 'page-id', true);
if ( $page ) :
yoast_breadcrumb('<div class="c-breadcrumbs"><a href="' . pll_home_url() . '">' . pll__('Home page') . '</a> › ' . get_the_title( $page['ID'] ) . ' ','</div>');
endif;
else:
yoast_breadcrumb('<div class="c-breadcrumbs"><a href="' . pll_home_url() . '">' . pll__('Home page') . '</a> › ','</div>');
endif;
<?php <?php
$search = get_query_var('s');
$cityID = get_query_var('city');
$cityID = is_numeric($cityID) ? $cityID : '';
if ( $cityID && !$search ) : if ( cityID && !searchQuery ) :
$page = get_term_meta( $cityID, 'page-id', true); $page = get_term_meta( cityID, 'page-id', true);
if ( $page ) : if ( $page ) :
?> ?>
<link rel="canonical" href="<?php echo get_page_link( $page['ID'] ); ?>" /> <link rel="canonical" href="<?php echo get_page_link( $page['ID'] ); ?>" />
<? <?php
endif;
endif; endif;
elseif ( !cityID && !searchQuery && get_post_type() == 'page' && get_post_meta( get_the_ID(), 'built_in_taxonomies_city', true ) ):
?>
<link rel="canonical" href="<?php echo get_permalink(); ?>" />
<?php
endif;
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