add eng version

This commit is contained in:
arlemp@selectel.ru
2021-12-09 22:29:24 +03:00
parent aba07a8e1b
commit acde7f0e8b
9 changed files with 141 additions and 54 deletions

47
blocks/gamburger.php Normal file
View File

@@ -0,0 +1,47 @@
<?php
if (LANG_VERSION == 'en'){
$left_mob_menu = 'leftenmenu';
$gamburger_menu = 4789;
$part_title = 'Parts';
}
else{
$left_mob_menu = 'leftmenu';
$gamburger_menu = 23;
$part_title = 'Рубрики';
}
//$menu_items = wp_get_nav_menu_items($gamburger_menu);?>
<?php $menu_items = wp_get_nav_menu_items($gamburger_menu);?>
<div id="mobile_main_menu">
<div class="main_main">
<ul id="gamburer_menu" class="menu">
<li id="rubrics_start"><a href="#"><?=$part_title?><span class="rub_arrow">></span></a></li>
<?foreach ($menu_items as $item):?>
<li><a href="<?=$item->url?>"><?=$item->title?></a></li>
<?endforeach?>
</ul>
</div>
<?php /**wp_nav_menu( array(
'container_class' => 'main_main',
'menu' => 'mob_topmenu',
'menu_id' => 'gamburer_menu'
) ); **/?>
<div id="closed_mobile_menu"></div>
</div>
<div id="mobile_rubrics_menu">
<div id='rubrics_back'><strong><</strong> <span class="rub_back_title">назад</span></div>
<?php wp_nav_menu( array(
'menu_class'=>'menu_left',
'menu'=>$left_mob_menu
));?>
<div id="closed_mobile_rubrics_menu"></div>
</div>

View File

@@ -1,36 +1,7 @@
<header>
<?php $menu_items = wp_get_nav_menu_items(23);?>
<div id="mobile_main_menu">
<div class="main_main">
<ul id="gamburer_menu" class="menu">
<li id="rubrics_start"><a href="#">Рубрики<span class="rub_arrow">></span></a></li>
<?foreach ($menu_items as $item):?>
<li><a href="<?=$item->url?>"><?=$item->title?></a></li>
<?endforeach?>
</ul>
</div>
<?php /**wp_nav_menu( array(
'container_class' => 'main_main',
'menu' => 'mob_topmenu',
'menu_id' => 'gamburer_menu'
) ); **/?>
<div id="closed_mobile_menu"></div>
</div>
<div id="mobile_rubrics_menu">
<div id='rubrics_back'><strong><</strong> <span class="rub_back_title">назад</span></div>
<?php wp_nav_menu( array(
'menu_class'=>'menu_left',
'theme_location'=>'left'
));?>
<div id="closed_mobile_rubrics_menu"></div>
</div>
<?php include TEMPLATEPATH.'/blocks/gamburger.php'; ?>
<div id="mainlogo">
<a href="<?php echo home_url(); ?>"><img width="240" src = "<?=get_stylesheet_directory_uri()?>/pub/logo/vij_logo.svg" alt = "Ветеринария и жизнь. Газета и сайт" /></a>
@@ -72,6 +43,12 @@
<a href="<?=get_site_url()?>?s="><li class="btn_search"></li></a>
<a href="<?=get_site_url()?>/feed"><li class="btn_rss"></li></a>
<li class="toggle-nav" id="toggle-nav"></li>
<?if (LANG_VERSION == 'en'):?>
<a href="<?=get_site_url()?>"><li class="btn_lan">РУС</li></a>
<?else:?>
<a href="<?=get_site_url()?>/en"><li class="btn_lan">EN</li></a>
<?endif?>
</ul>

View File

@@ -1,8 +1,18 @@
<div class="menu-left-block">
<?
if (LANG_VERSION == 'en'){
$left_menu = 'leftenmenu';
}
else{
$left_menu = 'leftmenu';
}
?>
<?php wp_nav_menu( array(
'menu_class'=>'menu_left',
'theme_location'=>'left',
'menu' => $left_menu
));?>
</div>

View File

@@ -14,8 +14,11 @@
# вывод поста
if( $posts ):?>
<?if (LANG_VERSION == 'en'):?>
<div class="yets_rubric">More on the topic</div>
<?else:?>
<div class="yets_rubric">Еще по теме</div>
<?endif?>
<div class="yets">

View File

@@ -33,7 +33,7 @@ $nn = 0;?>
<h2 class="main-card-title"><a href="<?the_permalink();?>"><?the_title();?></a></h2>
<div class="main-card-body">
<div class="main-card-text"><a href="<?the_permalink();?>"><?the_excerpt();?></a></div>
<div class="news_date"><?the_time('j F Y, G:i');?></div>
<div class="news_date"><?echo mysql2date( 'j F Y, H:i', $post->post_date, false );?></div>
</div>
</div>
@@ -54,7 +54,7 @@ $nn = 0;?>
<?endif?>
<h2 class="mini-card-title"><a href="<?the_permalink();?>"><?the_title();?></a></h2>
<div class="mini-card-body">
<div class="news_date"><?the_time('j F Y, G:i');?></div>
<div class="news_date"><?echo mysql2date( 'j F Y, H:i', $post->post_date, false );?></div>
</div>
</div>

View File

@@ -484,6 +484,28 @@ function citata_title($percon){
}
# helper find perevod author
function find_perevod($post_id){
$author = '';
$perevod_name = get_post_meta( $post_id, 'perevod_name', true );
if ( ! empty ( $perevod_name )){
$user_info = get_userdata($perevod_name);
if (isset($user_info->display_name)){
$author = $user_info->display_name;
}
}
if ($author !== ''){
return " / Translated by $author";
}
else {
return '';
}
}
add_action( 'pre_get_posts', function ($query) {

View File

@@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title><?php wp_title('|', true, 'right');?><?=get_bloginfo('name')?></title>
<link rel="stylesheet" href="<?php echo get_stylesheet_uri();?>?ver=92">
<link rel="stylesheet" href="<?php echo get_stylesheet_uri();?>?ver=96">
<link href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" rel="stylesheet">
<script type='text/javascript' src="<?php echo get_stylesheet_directory_uri()?>/scripts/jquery-3.6.0.min.js"></script>
<script type='text/javascript' src="<?php echo get_stylesheet_directory_uri()?>/scripts/golos.js"></script>
@@ -29,6 +29,22 @@
</noscript>
<!-- End Facebook Pixel Code -->
<? $lang_version = lang_version();
if ($lang_version == 'en'){
$mainmenu = 'topenmenu';
$mob_main_menu = 'topenmenu';
}
else {
$mainmenu = 'topmenu';
$mob_main_menu = 'mob_rubrics';
}
define('LANG_VERSION', $lang_version);
?>
<?php include TEMPLATEPATH.'/blocks/header.php';
//get_template_part( '/blocks/header.php');?>

View File

@@ -25,7 +25,7 @@
<div class="post_info">
<div class="post_info_sub">
<span class="post_link_category"><a href="<?=$category_link?>"><?=$category['0']->name;?></a></span>, <? echo mysql2date( 'j F Y H:i', $post->post_date, false );?>
<span class="post_link_category"><a href="<?=$category_link?>"><?=$category['0']->name;?></a></span>, <? echo mysql2date( 'j M Y H:i', $post->post_date, false );?>
</div>
<div class="post_info_sub post_info_social"
<?php include get_template_directory().'/blocks/social-share.php';?>
@@ -35,10 +35,15 @@
<?$author = get_the_author();
if ( ! empty ( $author ) AND $author !== 'vetandlife.ru'):?>
<div class="post_author">
By <?php the_author(); ?>
By <?php the_author(); ?><?=find_perevod($post->ID)?>
</div>
<?endif?>
<div class="publ_expert"><?php the_excerpt();?></div>
<?if ( has_post_thumbnail() ) :?>
<div id="post-img">
@@ -61,18 +66,18 @@
<div class="post_panel_info">
<div class="post_panel_info_sub">
<span class="post_link_category"><a href="<?=$category_link?>"><?=$category['0']->name;?></a></span>, <?php echo mysql2date( 'j F Y H:i', $post->post_date, false );?>
<span class="post_link_category"><a href="<?=$category_link?>"><?=$category['0']->name;?></a></span>, <?php echo mysql2date( 'j M Y H:i', $post->post_date, false );?>
</div>
<div class="post_panel_info_sub">
<!--Поделиться <i class="fas fa-share-square btn_soc_post"></i>--> <?php include get_template_directory().'/blocks/social-share.php';?>
</div>
</div>
<?php include get_template_directory().'/blocks/moread.php';?>
<?php //include get_template_directory().'/blocks/moread.php';?>
<div class="publ-to-main">
<button class="more_button" onclick="location.href='<?=get_site_url()?>/page/2'" type="button">
На главную</button>
<button class="more_button" onclick="location.href='<?=get_site_url()?>/en'" type="button">
Mainpage</button>
</div>

View File

@@ -646,27 +646,27 @@ a{
height: 20px;
}
.menu-item-11{
.menu-item-11, .menu-item-17474{
background: no-repeat url(https://vetandlife.ru/wp-content/themes/vij/pub/menu/molotok.svg) left center;
}
.menu-item-11:hover{
.menu-item-11:hover, .menu-item-17474:hover{
background: no-repeat url(https://vetandlife.ru/wp-content/themes/vij/pub/menu/molotok-orange.svg) left center;
}
.menu-item-12{
.menu-item-12, .menu-item-17473{
background: no-repeat url(https://vetandlife.ru/wp-content/themes/vij/pub/menu/epizoo.svg) left center;
}
.menu-item-12:hover{
.menu-item-12:hover, .menu-item-17473:hover{
background: no-repeat url(https://vetandlife.ru/wp-content/themes/vij/pub/menu/epizoo-orange.svg) left center;
}
.menu-item-15{
.menu-item-15, .menu-item-17475{
background: no-repeat url(https://vetandlife.ru/wp-content/themes/vij/pub/menu/zoo.svg) left center;
}
.menu-item-15:hover{
.menu-item-15:hover, .menu-item-17475:hover{
background: no-repeat url(https://vetandlife.ru/wp-content/themes/vij/pub/menu/zoo-orange.svg) left center;
}
@@ -861,6 +861,15 @@ a{
height: 15px;
}
.btn_rss{
background: url(/wp-content/themes/vij/pub/icons/header-rss.png) no-repeat;
}
.btn_lan{
font-weight: bold;
margin-top: -4px;
}
#copy{
display: inline-block;
text-align: center;
@@ -878,11 +887,6 @@ a{
}
.btn_rss{
background: url(/wp-content/themes/vij/pub/icons/header-rss.png) no-repeat;
}
#content{
margin-right: 58px;
margin-left: 58px;
@@ -1986,6 +1990,7 @@ span.rub_back_title{
.toggle-nav {
display: inline-block !important;
background: url(/wp-content/themes/vij/pub/icons/burger-15.png) no-repeat;
padding-left: 12px;
}
.btn_rss{
@@ -2158,13 +2163,15 @@ span.rub_back_title{
#header_icons li{
width: 20px;
height: 15px;
margin-left: 6px;
margin-left: 8px;
cursor: pointer;
}
.toggle-nav {
display: inline-block !important;
background: url(/wp-content/themes/vij/pub/icons/burger-15.png) no-repeat;
padding-left: 12px;
}