add menus
This commit is contained in:
34
blocks/events.php
Normal file
34
blocks/events.php
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
# три последних эвента
|
||||||
|
|
||||||
|
$posts = get_posts( array(
|
||||||
|
'numberposts' => 3,
|
||||||
|
'category' => 44, // 44 - мероприятия
|
||||||
|
'orderby' => 'date',
|
||||||
|
'order' => 'DESC',
|
||||||
|
'include' => array(),
|
||||||
|
'exclude' => array(),
|
||||||
|
'meta_key' => '',
|
||||||
|
'meta_value' =>'',
|
||||||
|
'post_type' => 'post',
|
||||||
|
'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса
|
||||||
|
) );
|
||||||
|
|
||||||
|
# вывод поста
|
||||||
|
if( $posts ):
|
||||||
|
|
||||||
|
foreach($posts as $post):
|
||||||
|
setup_postdata( $post );
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="event">
|
||||||
|
<div class="news_date"><?the_time('j F Y');?></div>
|
||||||
|
<a href="<?php the_permalink(); ?>"><?php the_title();?></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php endforeach;
|
||||||
|
|
||||||
|
wp_reset_postdata();
|
||||||
|
|
||||||
|
endif;
|
||||||
37
blocks/moread.php
Normal file
37
blocks/moread.php
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$posts = get_posts( array(
|
||||||
|
'numberposts' => 4,
|
||||||
|
'category' => 0, // пока без категории
|
||||||
|
'orderby' => 'date',
|
||||||
|
'order' => 'DESC',
|
||||||
|
'include' => array(),
|
||||||
|
'exclude' => array(),
|
||||||
|
'meta_key' => '',
|
||||||
|
'meta_value' =>'',
|
||||||
|
'post_type' => 'post',
|
||||||
|
'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса
|
||||||
|
) );
|
||||||
|
|
||||||
|
# вывод поста
|
||||||
|
if( $posts ):?>
|
||||||
|
|
||||||
|
<div class="moread">
|
||||||
|
<h4>Самое читаемое:</h3>
|
||||||
|
<?php foreach($posts as $post):
|
||||||
|
setup_postdata( $post );
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="moread_card">
|
||||||
|
<img src="<?php echo get_the_post_thumbnail_url($post, 'moread');?>" alt="<?the_title();?>">
|
||||||
|
<a href="<?php the_permalink(); ?>"><?php the_title();?></a>
|
||||||
|
<div><?the_time('j F Y, G:i');?></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php endforeach;?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php wp_reset_postdata();
|
||||||
|
|
||||||
|
endif?>
|
||||||
35
blocks/mosts.php
Normal file
35
blocks/mosts.php
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$posts = get_posts( array(
|
||||||
|
'numberposts' => 3,
|
||||||
|
'category' => 0, // пока без категории
|
||||||
|
'orderby' => 'date',
|
||||||
|
'order' => 'DESC',
|
||||||
|
'include' => array(),
|
||||||
|
'exclude' => array(),
|
||||||
|
'meta_key' => '',
|
||||||
|
'meta_value' =>'',
|
||||||
|
'post_type' => 'post',
|
||||||
|
'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса
|
||||||
|
) );
|
||||||
|
|
||||||
|
# вывод поста
|
||||||
|
if( $posts ):?>
|
||||||
|
|
||||||
|
<div id="mosts">
|
||||||
|
<h3 class="most_title">Самое читаемое:</h3>
|
||||||
|
<?php foreach($posts as $post):
|
||||||
|
setup_postdata( $post );
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="most">
|
||||||
|
<a href="<?php the_permalink(); ?>"><?php the_title();?></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php endforeach;?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php wp_reset_postdata();
|
||||||
|
|
||||||
|
endif?>
|
||||||
31
blocks/opinion.php
Normal file
31
blocks/opinion.php
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$posts = get_posts( array(
|
||||||
|
'numberposts' => 1,
|
||||||
|
'category' => 7, // 7 - мнения
|
||||||
|
'orderby' => 'date',
|
||||||
|
'order' => 'DESC',
|
||||||
|
'include' => array(),
|
||||||
|
'exclude' => array(),
|
||||||
|
'meta_key' => '',
|
||||||
|
'meta_value' =>'',
|
||||||
|
'post_type' => 'post',
|
||||||
|
'suppress_filters' => true, // подавление работы фильтров изменения SQL запроса
|
||||||
|
) );
|
||||||
|
|
||||||
|
# вывод поста
|
||||||
|
if( $posts ):
|
||||||
|
|
||||||
|
foreach($posts as $post):
|
||||||
|
setup_postdata( $post );
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
<img class="left_preview" src="<?php echo get_the_post_thumbnail_url($post, 'left-thumb');?>" alt="<?the_title();?>">
|
||||||
|
<a href="<?php the_permalink(); ?>"><?php the_title();?></a>
|
||||||
|
|
||||||
|
<?php endforeach;
|
||||||
|
|
||||||
|
wp_reset_postdata();
|
||||||
|
|
||||||
|
endif;
|
||||||
0
blocks/subscipts.php
Normal file
0
blocks/subscipts.php
Normal file
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<h1 class="my-4">Главное</h1>
|
|
||||||
<?php if (have_posts()): while(have_posts()): the_post();?>
|
<?php if (have_posts()): while(have_posts()): the_post();?>
|
||||||
<h2 class="card-title"><a href="<?the_permalink();?>"><?the_title();?></a></h2>
|
<h2 class="card-title"><a href="<?the_permalink();?>"><?the_title();?></a></h2>
|
||||||
<div class="card mb-4">
|
<div class="card mb-4">
|
||||||
|
|||||||
26
footer.php
26
footer.php
@@ -5,13 +5,23 @@
|
|||||||
|
|
||||||
?>
|
?>
|
||||||
<div id="left">
|
<div id="left">
|
||||||
<?php wp_nav_menu( array(
|
|
||||||
'menu_class'=>'menu_left',
|
|
||||||
'theme_location'=>'left'
|
<?php wp_nav_menu( array(
|
||||||
));?>
|
'menu_class'=>'menu_left',
|
||||||
|
'theme_location'=>'left'
|
||||||
|
));?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<?php //блок мнений
|
||||||
|
include get_template_directory().'/blocks/opinion.php';?>
|
||||||
|
|
||||||
|
<?php include get_template_directory().'/blocks/events.php';?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<aside>
|
<div id="right">
|
||||||
<div id="socials">
|
<div id="socials">
|
||||||
<div class="soc_btn soc_vk"></div>
|
<div class="soc_btn soc_vk"></div>
|
||||||
<div class="soc_btn soc_fb"></div>
|
<div class="soc_btn soc_fb"></div>
|
||||||
@@ -19,7 +29,11 @@
|
|||||||
<div class="soc_btn soc_youtube"></div>
|
<div class="soc_btn soc_youtube"></div>
|
||||||
<div class="soc_btn soc_instagram"></div>
|
<div class="soc_btn soc_instagram"></div>
|
||||||
</div>
|
</div>
|
||||||
</aside>
|
|
||||||
|
<script src="//web.webformscr.com/apps/fc3/build/loader.js" async sp-form-id="caf123c41c347524b52869629e2a958536e65900b89bb2f72592f6e4796d554e"></script>
|
||||||
|
|
||||||
|
<?php include get_template_directory().'/blocks/mosts.php';?>
|
||||||
|
</div>
|
||||||
</div><!-- end main -->
|
</div><!-- end main -->
|
||||||
<footer>
|
<footer>
|
||||||
<?php wp_footer(); ?>
|
<?php wp_footer(); ?>
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
define('IMGURL', 'http://img.vetandlife.ru/');
|
||||||
|
|
||||||
# регистрируем меню
|
# регистрируем меню
|
||||||
register_nav_menus(array(
|
register_nav_menus(array(
|
||||||
'top' => 'Верхнее меню',
|
'top' => 'Верхнее меню',
|
||||||
@@ -7,5 +9,9 @@ register_nav_menus(array(
|
|||||||
'left' => 'Левое меню'
|
'left' => 'Левое меню'
|
||||||
));
|
));
|
||||||
|
|
||||||
|
# поддержка миниматюр
|
||||||
add_theme_support('post-thumbnails');
|
add_theme_support('post-thumbnails');
|
||||||
|
|
||||||
|
# регистрируем размеры миниатюр
|
||||||
|
add_image_size( 'left-thumb', 95, 84, true ); # для левой колонки
|
||||||
|
add_image_size( 'moread', 372, 216, true ); # читайте также
|
||||||
33
index.php
33
index.php
@@ -6,8 +6,39 @@
|
|||||||
|
|
||||||
get_header(); ?>
|
get_header(); ?>
|
||||||
|
|
||||||
|
|
||||||
<div id="main">
|
<div id="main">
|
||||||
<?php get_template_part('content') ?>
|
|
||||||
|
|
||||||
|
<?php $query = new WP_Query(
|
||||||
|
array('category__not_in' => array(2, 18 ,44)
|
||||||
|
)); # фильтруем рубрики
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div id="content">
|
||||||
|
|
||||||
|
<h1 class="my-4">Главное</h1>
|
||||||
|
|
||||||
|
<?php if($query->have_posts()) : while($query->have_posts()) : $query->the_post();?>
|
||||||
|
|
||||||
|
<div class="card mb-4">
|
||||||
|
<a href="<?the_permalink();?>"><img class="card-img-top" src="<?php echo get_the_post_thumbnail_url(null, 'full'); ?>" alt="<?the_title();?>"></a>
|
||||||
|
<h2 class="card-title"><a href="<?the_permalink();?>"><?the_title();?></a></h2>
|
||||||
|
<div class="card-body">
|
||||||
|
<p class="card-text"><a href="<?the_permalink();?>"><?the_excerpt();?></a></p>
|
||||||
|
<div class="news_date"><?the_time('j F Y, G:i');?></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<?php endwhile;?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php endif;?>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
55
single.php
55
single.php
@@ -1,10 +1,49 @@
|
|||||||
<?php get_header();?>
|
<?php get_header();?>
|
||||||
<?while(have_posts()):
|
|
||||||
the_post();?>
|
<div id="main">
|
||||||
<h1 class="my-4 page-title"><?wp_title();?></h1>
|
<div>
|
||||||
<img class="img-fluid rounded" src="<?php echo get_the_post_thumbnail_url(null, 'full');?>" alt="<?the_title();?>">
|
<?//while(have_posts()):?>
|
||||||
<p><small class="text-muted"><?the_time('j F Y');?> <?php the_tags('');?></small></p>
|
|
||||||
<?the_content();?>
|
<?php $category = get_the_category();
|
||||||
<?php comments_template(); ?>
|
$category_id = $category[0]->term_id;
|
||||||
<?endwhile;?>
|
$category_link = get_category_link($category_id);
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="post_info">
|
||||||
|
<a href="<?=$category_link?>"><?=$category['0']->name;?></a>, <?php the_time('j F Y, G:i');?>
|
||||||
|
</div>
|
||||||
|
<h1 class="my-4"><?php wp_title('');?></h1>
|
||||||
|
<div class="publ_expert"><?php the_excerpt();?></div>
|
||||||
|
<img class="img-fluid rounded" src="<?php echo get_the_post_thumbnail_url(null, 'full');?>" alt="<?the_title();?>">
|
||||||
|
<div class="post_img_title"><?the_post_thumbnail_caption()?></div>
|
||||||
|
<?the_content();?>
|
||||||
|
<!--<p><small class="text-muted"><?php the_tags('');?></small></p> -->
|
||||||
|
<?//endwhile;?>
|
||||||
|
|
||||||
|
<div class="post_author">
|
||||||
|
Автор: <?php the_author(); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="post_panel_info">
|
||||||
|
<a href="<?=$category_link?>"><?=$category['0']->name;?></a>, <?php the_time('j F Y, G:i');?> Поделиться
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php include get_template_directory().'/blocks/moread.php';?>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?php get_footer();?>
|
<?php get_footer();?>
|
||||||
114
style.css
114
style.css
@@ -93,7 +93,7 @@ a{
|
|||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
#main > #left,
|
#main > #left,
|
||||||
#main > aside {
|
#main > #right {
|
||||||
flex: 0 0 20vw;
|
flex: 0 0 20vw;
|
||||||
background: beige;
|
background: beige;
|
||||||
}
|
}
|
||||||
@@ -101,10 +101,22 @@ a{
|
|||||||
order: -1;
|
order: -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#left{
|
||||||
|
width: 330px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
#right{
|
||||||
|
width: 330px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
header{
|
header{
|
||||||
background-color: white;
|
background-color: white;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction:
|
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -127,13 +139,26 @@ a{
|
|||||||
ul.menu_left{
|
ul.menu_left{
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
background-color: #00466A;
|
||||||
|
padding-top: 8px;
|
||||||
|
padding-bottom: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.menu_left li{
|
ul.menu_left li{
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 12px;
|
font-size: 14px;
|
||||||
line-height: 150%;
|
line-height: 150%;
|
||||||
text-transform: uppercase;
|
/*text-transform: uppercase;*/
|
||||||
|
padding-top: 4px;
|
||||||
|
padding-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.menu_left li a{
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.current-menu-item {
|
||||||
|
color: #2D9CDB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -154,12 +179,9 @@ a{
|
|||||||
footer {
|
footer {
|
||||||
background: #E2E2E2;
|
background: #E2E2E2;
|
||||||
height: 20vh;
|
height: 20vh;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
header, footer, article, nav, aside {
|
header, footer, article, nav, #right {
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,17 +237,89 @@ a{
|
|||||||
padding: 8px 0 8px 0;
|
padding: 8px 0 8px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.event{
|
||||||
|
padding: 8px 0 8px 0;
|
||||||
|
border-bottom: 1px solid black;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#mosts{
|
||||||
|
background-color: #00466A;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.most_title{
|
||||||
|
color: #2D9CDB;
|
||||||
|
}
|
||||||
|
|
||||||
|
.most{
|
||||||
|
padding: 8px;
|
||||||
|
color: #FFFFFF;
|
||||||
|
font-size: 16px;
|
||||||
|
line-height: 22.4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.most a{
|
||||||
|
color: #FFFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.left_preview{
|
||||||
|
border-radius: 50%;
|
||||||
|
width: 95px;
|
||||||
|
height: 84px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.publ_expert{
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-bottom: 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post_info{
|
||||||
|
font-size: 14px;
|
||||||
|
color: #444444;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post_img_title{
|
||||||
|
color: #909294;
|
||||||
|
}
|
||||||
|
.post_img_title a{
|
||||||
|
color: #909294;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post_panel_info{
|
||||||
|
font-size: 14px;
|
||||||
|
border-top: 1px solid #E9EAEB;
|
||||||
|
border-bottom: 1px solid #E9EAEB;
|
||||||
|
padding: 12px 0 12px 0;
|
||||||
|
margin 18px 0 18px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.moread{
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
||||||
|
grid-gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.moread_card{
|
||||||
|
padding 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.more_card IMG{
|
||||||
|
width: 372px;
|
||||||
|
height: 216px;
|
||||||
|
}
|
||||||
|
|
||||||
/** socials */
|
/** socials */
|
||||||
|
|
||||||
#socials{
|
#socials{
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.soc_btn{
|
.soc_btn{
|
||||||
height: 24px;
|
height: 24px;
|
||||||
width: 24px;
|
width: 24px;
|
||||||
border-radius: 10px;
|
/*border-radius: 10px;*/
|
||||||
border: 1px solid #E9EAEB;
|
border: 1px solid #E9EAEB;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user