File: /www/wwwroot/www.scdc-marine.com/wp-content/themes/scdc-marine/TempParts/Search/search.php
<?php
/**
* 搜索页面
*/
$pipei = get_query_var('s');
$product_posts = get_posts( [
'fields' => 'ids',
'posts_per_page' => -1,
'post_type' => ['post'],
's' => $pipei,
] );
$news_posts = get_posts( [
'fields' => 'ids',
'posts_per_page' => -1,
'post_type' => ['news'],
's' => $pipei,
] );
$deft_posts = get_posts( [
'fields' => 'ids',
'posts_per_page' => 3,
'post_type' => ['post'],
] );
?>
<!-- / star heku_top -->
<?php get_template_part( "TempParts/Main/TopMenu/top_menu"); ?>
<?php get_template_part( "TempParts/Main/TopBanner/top_banner"); ?>
<!-- / end heku_top -->
<!-- / star single_bar_line -->
<?php get_template_part("TempParts/Main/Breadcrumb/breadcrumb"); ?>
<!-- / end single_bar_line -->
<?php // get_template_part( 'TempParts/Search/heku-search_temp-1'); ?>
<!-- start #archive_project_line -->
<div id="archive_project_line">
<div class="container">
<div class="row no-gutters clearfix">
<div class="single-sidebar ">
<!-- / star single_bar_line -->
<?php get_template_part("TempParts/Main/Sidebar/sidebar"); ?>
<!-- / end single_bar_line -->
</div>
<div class="single-main col clearfix news-line ">
<ul class="news—item-ul_1 no-gutters row">
<!-- end heku-top-menu -->
<?php if( isset( $product_posts[0] ) && ( count($product_posts) > 0 ) ){ ?>
<div style="font-size: 24px;padding-bottom: 16px;">在产品中关于搜索词:<span style="color: red;"><?php echo $pipei; ?></span> 的搜索结果:</div>
<?php foreach( $product_posts as $post): ?>
<?php setup_postdata($post); ?>
<?php get_template_part("TempParts/Main/item-Template/item-product"); ?>
<?php endforeach; ?>
<?php wp_reset_postdata();
} ?>
<?php if( isset( $news_posts[0] ) && ( count($news_posts) > 0 ) ){ ?>
<div style="font-size: 24px;padding-bottom: 16px;">在新闻案例中关于搜索词:<span style="color: red;"><?php echo $pipei; ?></span> 的搜索结果:</div>
<?php foreach( $news_posts as $post): ?>
<?php setup_postdata($post); ?>
<?php get_template_part("TempParts/Main/item-Template/item-news"); ?>
<?php endforeach; ?>
<?php wp_reset_postdata();
} ?>
<?php if(( count($news_posts) == 0 ) && ( count($product_posts) == 0 ) ){ ?>
<?php foreach( $deft_posts as $post): ?>
<?php setup_postdata($post); ?>
<?php get_template_part("TempParts/Main/item-Template/item-product"); ?>
<?php endforeach; ?>
<?php wp_reset_postdata();
} ?>
</ul>
</div>
</div>
</div>
</div>
<!-- / end #archive_project_line -->
<style>
.sidebar-nav-menu > li .sidebar-cat-img{width: 72px;padding: 0 10px;}
.sidebar-nav-menu > li{list-style: none;line-height:60px;overflow: hidden;}
.sidebar-nav-menu .current-menu-item .sub-menu-0{max-height: 500px;overflow: hidden;}
.sidebar-nav-menu > li .icon:before{content:"\e615";}
.sidebar-nav-menu li.current-menu-item .icon:before{content:"\e617";}
.sidebar-nav-menu > li .icon{float: right;padding-right:12px;}
.sidebar-nav-menu .sub-menu-0 {padding: 0 20px;max-height: 0px;-webkit-transition:all 0.7s ease-out 0s;-moz-transition:all 0.7s ease-out 0s;-ms-transition:all 0.7s ease-out 0s;-o-transition:all 0.7s ease-out 0s;transition:all 0.7s ease-out 0s;}
.sidebar-nav-menu .sub-menu-0 > li{border-bottom:1px solid var(--forecolor);border-bottom-style:dashed;color:var(--forecolor);list-style:none;}
.sidebar-nav-menu li.current-menu-item .sidebar-menu-li,.sidebar-nav-menu > li:hover .sidebar-menu-li{background:var(--forecolor_translucent_3) ;border:1px solid #ceb4b4;border-right:3px solid #e32626;border-left:3px solid #e32626;}
.sidebar-nav-menu li.current-menu-item .sidebar-menu-li a span,.sidebar-nav-menu > li:hover .sidebar-menu-li a span{font-size:20px;color:var(--color_eye);}
.sidebar-nav-menu li .sidebar-menu-li a span{font-size:18px;}
.sidebar-nav-menu li .sidebar-menu-li{padding: 0 6px;}
.sidebar-nav-menu .sub-menu-0 > li:last-child{border-bottom: none;}
/* ----------------------------------------------------
43) .single-sidebar 新闻侧边栏 ,展示模板:Sing-news-temp01 css样式
------------------------------------------------------- */
.single-sidebar{padding:0px 32px 0px 0px;width:320px;}
.single-sidebar .about-header,.single-sidebar .toc-header{font-size:24px;padding:15px 15px 12px 25px;border-bottom:1px solid var(--forecolor);border-bottom-style:dashed;color:var(--forecolor);}
.single-sidebar .about-header .icon,.single-sidebar .toc-header .icon{font-size:24px;padding:0 12px 0 0px;}
/* --- 1) .about-sidebar 相关推荐 新闻列表 css --- */
.about-sidebar{position:sticky;overflow:hidden;margin-bottom:24px;}
.about-container .news-img img{width:100px;height:64px;border-radius:var(--radius_img);display:block;cursor:pointer;}
.about-container .news-item{visibility:visible;animation-name:fadeInUp;padding:8px 0px;font-weight:400;display:-webkit-box;display:-ms-flexbox;display:flex;}
.about-container .news-item:hover,.about-sidebar .news-item:hover a{color:var(--color_eye);}
.about-container .news-comt{-webkit-box-orient:vertical;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;margin-left:12px;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;}
.about-container .news-comt .news-tit a{font-family:PingFangSC-Regular;font-weight:400;font-size:16px;line-height:22px;letter-spacing:0;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;cursor:pointer;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-box-orient:vertical;}
.about-container .news-comt .news-attribute{font-size: 14px;opacity: 0.6;padding-right: 8px;}
.about-container .news-comt .news-attribute .single-eye .icon{font-size:14px;padding-right:6px;}
/* --- 1) 小于780尺寸时候使用¸ --- sm --- */
@media only screen and (max-width:768px){
.single-sidebar{padding:0px 32px 0px 0px;width:320px;}
}
/* --- 1) 小于780尺寸时候使用 手机 mobile --- */
@media (max-width:576px){
.single-sidebar{padding:0px 32px 0px 0px;width:320px;}
}
/* --- 2) 大于768px尺寸 min --- */
@media(min-width:768px){
.single-sidebar{padding:0px 0x 0px 0px;width:0px;}
}
/* --- 3) 大于992px尺寸 mid --- */
@media(min-width:992px){
.single-sidebar{padding:0px 32px 0px 0px;width:320px;}
}
/* --- 4) 显示规定 大于1200尺寸时候使用 max --------- */
@media(min-width:1200px){
.single-sidebar{padding:0px 32px 0px 0px;width:320px;}
}
/* ----------------------------------------------------
12) start #archive-news 新闻中心
------------------------------------------------------- */
.page_bar_1 .page_arr_left{text-align: left}
.page_bar_1 .page_arr_center{text-align: center}
.page_bar_1 .page_arr_center a{padding: 1px 10px;}
.page_bar_1 .page_arr_center a.current,.page_bar_1 .page_arr_center a:hover{background:#4473c3;color:#fff;border-radius:50% 50%;}
.page_bar_1 .page_arr_center a{font-size: 18px;color: #323232;}
.page_bar_1 .page_arr_right{text-align: right}
.page_bar_1 .pages-row{line-height:30px}
.page_bar_1 .transition{-webkit-transition:all 0.4s ease;transition:all 0.4s ease;}
.page_bar_1 .pages-row b{width:10%;height:1px;background-color:#000;display:inline-block;*display:inline;*zoom:1;vertical-align:middle;margin:0 10px;}
.page_bar_1 a:hover b{width:40%;background-color: #235bb8;}
.page_bar_1 a{margin: 0 6px;}
.page_bar_1 .pointernone{pointer-events:none;color:#ddd;}
.page_bar_1 .pages-row .pointernone b{background-color:#ddd; }
.page_bar_1 a{color: #666;}
.page_bar_1 a:hover{color: #235bb8;}
.page_bar_2 .page_arr_left,.page_bar_2 .page_arr_center,.page_bar_2 .page_arr_right{display: inline-block;}
.page_bar_2 .page_arr_center a.current,.page_bar_2 .page_arr_center a:hover{background:#4473c3;color:#fff;border-radius:50% 50%;}
.page_bar_2 a{font-size: 18px;color: #323232;}
.page_bar_2 a{padding: 1px 10px;}
.page_bar_2 .pages-row{line-height:30px;text-align: center}
.page_bar_2 a{margin: 0 6px;}
.page_bar_2 a{color: #666;}
.page_bar_2 .page_arr_left a:hover,.page_bar_2 .page_arr_right a:hover{color:#4473c3;}
.news—item-ul_1 .news-item{box-shadow: 0px 2px 5px rgba(0,0,0,0.26);background: #f7f7f7;border-radius: 8px;margin: 0px 0px 25px 0px;position: relative;}
.news—item-ul_1 .news-item .news-img{width: 100%;border-radius: 6px;overflow: hidden;}
.news—item-ul_1 .news-item .news-time{right: 10px;position: absolute;}
.news—item-ul_1 .news-item .news-tit a{font-size: 24px;color: #000000;height: 76px;overflow: hidden;font-weight: 600;letter-spacing: 1px;}
.news—item-ul_1 .news-item .news-tit a span{display: inline-block;vertical-align: middle;line-height: 38px;}
.news—item-ul_1 .news-item .news-summary span{color: #898b8e;}
.news—item-ul_1 .news-item .news-time-d{font-size: 50px;line-height: 50px;font-weight: bolder;}
.news—item-ul_1 .news-item:hover .news-tit a span{color: #235bb8;}
.news—item-ul_1 .news-item:hover .heku-btn{color: #ffffff;border: 0px solid #ffffff;background: rgb(35 91 184);}
.news—item-ul_1 .news-item .heku-btn .icon{font-size: 12px;}
.news—item-ul_1 .news-item:hover .news-time{color: #235bb8;}
.news—item-ul_1 .news-item .news-comt{padding-left: 40px;}
.news—item-ul_1 .news-item:hover{background: #ddd}
/* --- 1) å°äºŽ780尺寸 --- sm --- */
@media only screen and (max-width: 768px){
.news-item .news-tit a{font-size: 18px;height: 64px;}
.news-item .news-tit a span{line-height: 24px;color: #235bb8;}
.news-item .news-summary span{font-size: 14px;}
.news-item .news-comt{padding-left: 0px;}
}
/* --- 0) 手机 --- mobile --- */
@media (max-width: 576px){
.news-item .news-tit a{font-size: 18px;height: 48px;}
.news-item .news-tit a span{line-height: 24px;color: #235bb8;}
.news-item .news-summary span{font-size: 14px;}
.news-item .news-comt{padding-left: 0px;}
}
/* --- 2) 大于768px尺寸 --- md --- */
@media(min-width:768px){
.news-item .news-tit a{font-size: 18px;height: 64px;}
.news-item .news-tit a span{line-height: 32px;}
.news-item .news-comt{padding-left: 30px;}
}
/* --- 3) 大于992px尺寸 --- lg --- */
@media(min-width:992px){
.news-item .news-tit a{font-size: 20px;height: 64px;}
.news-item .news-tit a span{line-height: 32px;}
.news-item .news-comt{padding-left: 30px;}
}
/* --- 4) 大于1200尺寸时候使用 --- xl --- */
@media(min-width:1200px){
.news-item .news-tit a{font-size: 24px;height: 76px;}
.news-item .news-tit a span{line-height: 38px;}
.news-item .news-comt{padding-left: 40px;}
}
/* ----------------------------------------------------
30-40) end #archive 60-79分类 åˆ†ç±»é¡µæ ·å¼
------------------------------------------------------- */
</style>