一、新增配置调用说明:
<?php echo get_option('aboutId'); ?> //关于我们ID
<?php echo get_option('contactId'); ?> //联系我们ID
<?php echo get_option('caseId'); ?> //案例ID
<?php echo get_option('newsId'); ?> //新闻ID
<?php echo get_option('newsCIds'); ?> //新闻子分类ID
<?php echo get_option('themeload'); ?> //采集图片路径(模板路径)-
<?php echo get_option('videoUrl'); ?> //youtube视频链接
<?php echo get_option('formUrl'); ?> //form链接
<?php echo get_option('facebookUrl'); ?> //facebook链接
<?php echo get_option('twitterUrl'); ?> //twitter链接
<?php echo get_option('linkedinUrl'); ?> //linkedin链接
<?php echo get_option('youtubeUrl'); ?> //youtube链接
<?php echo get_option('instagramUrl'); ?> //Instagram链接
<?php echo get_option('pinterestUrl'); ?> //Pinterest链接
<?php echo get_option('inquiryEmail'); ?> //询盘邮箱
<?php echo get_option('inquiryTel'); ?> //询盘电话
<?php echo get_option('inquiryWhatsApp'); ?> //询盘WhatsApp
<?php echo get_option('inquiryOpenJs'); ?> //在线客服JS触发代码
<?php echo get_option('addressInfo'); ?> //公司地址
<?php echo get_option('servicecode'); ?> //客服代码
<?php echo get_option('copyright'); ?> //版权
<?php echo get_option('logoBase64'); ?> //LogoBase
<?php bloginfo('template_url'); ?> //资源文件路径
<?php the_time("y-m-d"); ?> //日期调用
<?php bloginfo('url'); ?> //网站首页链接
<?php if(function_exists('the_views')) { the_views(); } ?> //详细页浏览量
$("body table").wrap("<div class='pro_table'></div>"); //表格添加滚动
二、关于导航调用新写法
关于我们
<a href="<?php echo get_page_link(get_option('aboutId'))?>" title="<?php echo get_page(get_option('aboutId'))->post_title; ?>">
<?php echo get_page(get_option('aboutId'))->post_title; ?>
</a>
联系我们
<a href="<?php echo get_page_link(get_option('contactId'))?>" title="<?php echo get_page(get_option('contactId'))->post_title; ?>">
<?php echo get_page(get_option('contactId'))->post_title; ?>
</a>
产品 一级下拉
<dd class="item">
<a href="<?php echo get_category_link(1)?>" title="<?php echo get_category(1)->name?>">
<?php echo get_category(1)->name?>
</a>
<!-- 产品下拉 -->
<?php if(get_categories(1)) { ?>
<div class="publicTwo_stage_nav">
<?php $cateList = json_decode(json_encode(get_categories('sort_column=name&optioncount=0&hierarchical=1&hide_empty=0&child_of=1')),TRUE);
foreach ($cateList as $key => $value) {
?>
<div class="EveryOne">
<a href="<?php echo get_category_link($value["cat_ID"]) ; ?>" title="<?php echo $value["name"]; ?>">
<div class="iconfont iconweibiaoti34"></div>
<span><?php echo $value["name"]; ?></span>
</a>
</div>
<?php } ?>
</div>
<?php } ?>
</dd>
产品 二级下拉
<dd>
<div class="menu_tt">
<a href="<?php echo get_category_link(1)?>" title="<?php echo get_category(1)->name?>">
<?php echo get_category(1)->name?>
</a>
<i class="iconfont icon-arr-right"></i>
</div>
<?php
$cat =1;
$cateList = json_decode(json_encode(get_categories('sort_column=name&optioncount=0&hierarchical=1&hide_empty=0&child_of='.$cat.'')),TRUE);
if($cateList){
?>
<div class="menu_second_box">
<div class="wrapper clearfix">
<?php
foreach ($cateList as $key => $value) {
if($value['parent'] == $cat){
@$cateDatalist[] = $value;
}
}
foreach ($cateDatalist as $key => $value) {
foreach ($cateList as $ckey => $cvalue) {
if($value['term_id'] == $cvalue['parent']){
$cateDatalist[$key]["c"][] = $cvalue;
}
}
}
//print_r($cateDatalist);
foreach ($cateDatalist as $key => $value) {
?>
<div class="menu_two hover">
<div class="menu_two_tt clearfix">
<a href="<?php echo get_category_link($value["cat_ID"]) ; ?>"> <?php echo $value["name"]; ?></a>
</div>
<?php
if($value['c']){
?>
<div class="menu_two_text">
<?php
foreach ($value['c'] as $vkey => $vvalue) {
?>
<a href="<?php echo get_category_link($vvalue["cat_ID"]); ?>"><label>></label> <?php echo $vvalue["name"]; ?></a>
<?php }
?>
</div>
<?php } ?>
</div>
<?php } ?>
</div>
</div>
<?php }?>
</dd>
新闻
<dd class="item">
<a href="<?php echo get_category_link(get_option('newsId'))?>" title="<?php echo get_category(get_option('newsId'))->name?>"><?php echo get_category(get_option('newsId'))->name?></a>
<!-- 二级导航 -->
<?php if(get_categories(get_option('newsId'))) { ?>
<div class="publicTwo_stage_nav">
<?php $cateList = json_decode(json_encode(get_categories('sort_column=name&optioncount=0&hierarchical=1&hide_empty=0&child_of='.get_option('newsId'))),TRUE);
foreach ($cateList as $key => $value) {
?>
<div class="EveryOne">
<a href="<?php echo get_category_link($value["cat_ID"]) ; ?>" title="<?php echo $value["name"]; ?>">
<div class="iconfont iconweibiaoti34"></div>
<span><?php echo $value["name"]; ?></span>
</a>
</div>
<?php } ?>
</div>
<?php } ?>
</dd>
案例
<dd class="item">
<a href="<?php echo get_category_link(get_option('caseId'))?>" title="<?php echo get_category(get_option('caseId'))->name?>">
<?php echo get_category(get_option('caseId'))->name; ?>
</a>
<!-- 二级导航 -->
<?php if(get_categories(get_option('caseId'))) { ?>
<div class="publicTwo_stage_nav">
<?php
$cateList= json_decode(json_encode(get_categories('sort_column=name&optioncount=0&hierarchical=1&hide_empty=0&child_of='.get_option('caseId'))),TRUE);
foreach ($cateList as $key => $value) {
?>
<div class="EveryOne">
<a href="<?php echo get_category_link($value["cat_ID"]) ; ?>" title="<?php echo $value["name"]; ?>">
<div class="iconfont iconweibiaoti34"></div>
<span><?php echo $value["name"]; ?></span>
</a>
</div>
<?php } ?>
</div>
<?php } ?>
</dd>
2.2首页调取新闻案例
新闻
<?php query_posts('cat='.get_option('newsId').'&posts_per_page=4'); while(have_posts()): the_post(); ?>
<dd>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" >
<div class="news_list1_date">
<?php if ( has_post_thumbnail() ) { ?>
<img src="<?php the_post_thumbnail_url(); ?>" alt="<?php the_title(); ?>"/>
<?php }else{?>
<?php $post_ID = get_the_ID();?>
<?php $category=get_the_category( $post_ID );$catId=$category[0]->term_id;?>
<?php $dir="/wp-content/themes/".get_option("themeload")."/load/$catId/";?>
<img src="<?php echo get_rand_img($dir);?>" alt="<?php the_title(); ?>"/>
<?php }?>
</div>
<div class="news_list1_tt uppercase textOverClm clm2">
<?php the_title(); ?>
</div>
<div class="news_list1_text textOverClm clm5">
<?php if(has_excerpt()) the_excerpt(); else echo mb_strimwidth(strip_tags($post->post_content),0,200,'...'); ?>
</div>
<div class="more_btn2 iconfont icon-jiantou2"></div>
</a>
</dd>
<?php endwhile; wp_reset_query(); ?>
案例
<?php query_posts('cat='.get_option('caseId').'&posts_per_page=3'); while(have_posts()): the_post(); ?>
<dd>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<div class="pic">
<img src="<?php the_post_thumbnail_url(); ?>" alt="<?php the_title(); ?>">
<div class="tt uppercase">
<?php the_title(); ?>
</div>
<div class="news_list1_text textOverClm clm5">
<?php if(has_excerpt()) the_excerpt(); else echo mb_strimwidth(strip_tags($post->post_content),0,200,'...'); ?>
</div>
</div>
<div class="btn uppercase">
View More
</div>
</a>
</dd>
<?php endwhile; wp_reset_query(); ?>
翻页
<!-- page -->
<div class="page uppercase">
<?php wp_pagenavi(); ?>
</div>
<!-- page end -->
三、新闻列表
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<dd class="item">
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>">
<div class="img_box">
<?php if ( has_post_thumbnail() ) { ?>
<img src="<?php the_post_thumbnail_url(); ?>" alt="<?php the_title(); ?>"/>
<?php }else{?>
<?php $post_ID = get_the_ID();?>
<?php $category=get_the_category( $post_ID );$catId=$category[0]->term_id;?>
<?php $dir="/wp-content/themes/".get_option("themeload")."/load/$catId/";?>
<img src="<?php echo get_rand_img($dir);?>" alt="<?php the_title(); ?>"/>
<?php }?>
</div>
<div class="center_box">
<div class="tt"><?php the_title(); ?></div>
<div class="text">
<?php if(has_excerpt()): //如果有摘要就显示,没有就从文章中截取 ?>
<?php the_excerpt(); ?>
<?php else: ?>
<?php
echo replaceData(mb_strimwidth(strip_tags(apply_filters('the_content',$post->post_content)),0,500,"..."));?>
<?php endif; ?>
</div>
<div class="public_More_btn active">
MORE
</div>
</div>
<div class="right_box">
<div class="date_01"><?php the_time("Y"); ?></div>
<div class="date_02"><?php the_time("m d"); ?></div>
</div>
</a>
</dd>
<?php endwhile; ?>
<?php endif; ?>
四、着陆页
<?php
$category = get_the_category();
$catId = $category[0]->cat_ID;
$dir="/wp-content/themes/".get_option("themeload")."/load/$catId/";
$content = replaceData($post->post_content);
$CJ = list_add_thumbs($content,$dir);
?>
<?php for($i=0;$i<count($CJ);$i++){?>
<dd class="item">
<a href="<?php echo get_option('inquiryOpenJs'); ?> " title="<?php echo get_the_title(); ?>">
<div class="img_box">
<img src="<?php echo $CJ[$i][1]; ?>" alt="<?php echo get_the_title(); ?>"/>
</div>
<div class="center_box">
<div class="tt"><?php echo $CJ[$i][0]; ?></div>
<div class="text">
<?php echo $CJ[$i][2]; ?>
</div>
<div class="public_More_btn active">
MORE
</div>
</div>
</a>
</dd>
<?php } ?>
标题、摘要、要注意跟之前不一样地方
<?php
$category = get_the_category();
$catId = $category[0]->cat_ID;
$dir="/wp-content/themes/".get_option("themeload")."/load/$catId/";
$content = replaceData($post->post_content);
$CJ = list_add_thumbs($content,$dir);
?>
详情页形式
<?php if(has_excerpt()): //如果有摘要就显示,没有就从文章中截取 ?>
<?php the_excerpt(); ?>
<?php else: ?>
<?php echo replaceData(mb_strimwidth(strip_tags(apply_filters('the_content',$post->post_content)),0,200,"..."));?>
<?php endif; ?>//摘要
<?php echo replaceData(get_the_content()); ?>//详情页的内容
<?php $post_id = 263; // 文章ID ?>
五、调取热卖(置顶文章)
<?php $wp_query = new WP_Query(array('cat'=>1,'showposts'=>8,'paged'=>1,'post__in'=>get_option('sticky_posts'),'caller_get_posts' => 0)); ?>
<?php if($wp_query->have_posts()) : while($wp_query->have_posts()) : $wp_query->the_post(); ?>
<div class="item">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" >
<div class="pic">
<img src="<?php the_post_thumbnail_url(); ?>" alt="<?php the_title(); ?>"/>
</div>
<div class="con">
<div class="tt">
<?php the_title(); ?>
</div>
<div class="text textOverClm clm2">
<?php if(has_excerpt()) the_excerpt(); else echo mb_strimwidth(strip_tags($post->post_content),0,100,'...'); ?>
</div>
</div>
</a>
</div>
<?php endwhile; ?>
<?php else : ?>
<?php endif; wp_reset_query(); ?>
六、面包屑
<?php if (function_exists('dimox_breadcrumbs')) dimox_breadcrumbs(); ?>
七、留言板
<form action="<?php echo get_option('formUrl'); ?>" method="post" onsubmit="this.url.value=window.location.href" class="foot_top_form">
<div class="item">
<span>Name:</span>
<input name="name" type="text">
</div>
<div class="item">
<span>Email:</span>
<input name="email" type="text">
</div>
<div class="item">
<span>Phone:</span>
<input name="phone" type="text">
</div>
<div class="item">
<span>Message:</span>
<input name="message" type="text">
</div>
<div class="btn_box">
<input type="hidden" name="url" value="">
<button>
<div class="iconfont icontijiao"></div>
<span>Submit</span>
</button>
</div>
</form>
八、详情页的标签
//轮播图
<?php if(get_field('img1',$post_id)){
?>
<div class="item">
<img src="<?php the_field('img1',$post_id)?>" alt="">
</div>
<?php }?>
<?php if(get_field('img2',$post_id)){
?>
<div class="item">
<img src="<?php the_field('img2',$post_id)?>" alt="">
</div>
<?php }?>
<?php if(get_field('img3')){
?>
<div class="item">
<img src="<?php the_field('img3',$post_id)?>" alt="">
</div>
<?php }?>
<?php if(get_field('img4',$post_id)){
?>
<div class="item">
<img src="<?php the_field('img4',$post_id)?>" alt="">
</div>
<?php }?>
//当前文章的标题、时间、特色图、内容、点击数
<?php the_title(); ?>
<?php the_time("Y m d"); ?>
<?php the_post_thumbnail_url(); ?>
<?php the_content(); ?>
<?php if(function_exists('the_views')) { the_views(); } ?>
//当前文章的简介
<?php if(has_excerpt()): //如果有摘要就显示,没有就从文章中截取 ?>
<?php the_excerpt(); ?>
<?php else: ?>
<?php echo mb_strimwidth(strip_tags(apply_filters('the_content',$post->post_content)),0,200,"...");?>
<?php endif; ?>
//上一页下一页
<?php if (get_previous_post()) { previous_post_link('Previous: %link','%title',true);} else { echo "Sorry,No new article.";} ?>
<?php if (get_next_post()) { next_post_link('Next: %link','%title',true);} else { echo "This is already the latest article";} ?>
//相关产品
<? $category = get_the_category();
$catid = $category[0]->cat_ID;?>
<?php query_posts("cat=$catid&posts_per_page=100"); while(have_posts()): the_post(); ?>
<dd class="item">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<div class="img_box">
<img src="<?php the_post_thumbnail_url(); ?>" alt="<?php the_title(); ?>">
</div>
<div class="bottom_box">
<div class="tt_01"><?php the_title(); ?></div>
<div class="tt_02 tt_05"><?php if(has_excerpt()) the_excerpt(); else echo mb_strimwidth(strip_tags($post->post_content),0,200,'...'); ?></div>
<div class="public_More_btn active">
MORE
</div>
</div>
</a>
</dd>
<?php endwhile; wp_reset_query(); ?>
九、调取分类下的文章
当前分类的ID $cat
<?php query_posts('cat='.get_option('newsId').'&posts_per_page=4'); while(have_posts()): the_post(); ?>
<dd class="item">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" >
<div class="left_text">
<div class="tt">
<?php the_title(); ?>
</div>
<div class="text">
<?php if(has_excerpt()) the_excerpt(); else echo mb_strimwidth(strip_tags($post->post_content),0,200,'...'); ?>
</div>
</div>
<div class="right_box">
<div class="text">
<?php the_time("m d"); ?>
</div>
<div class="text">
MORE
</div>
</div>
</a>
</dd>
<?php endwhile; wp_reset_query(); ?>
// 列表页的二级分类模块
<?php
$cateList = json_decode(json_encode(get_categories('sort_column=name&optioncount=0&hierarchical=1&hide_empty=0&child_of='.$cat.'')),TRUE);
if($cateList){
?>
<div class="pro_categorys_box">
<ul class="pro_categorys_list">
<?php
foreach ($cateList as $key => $value) {
if($value['parent'] == $cat){
@$cateDatalist[] = $value;
}
}
foreach ($cateDatalist as $key => $value) {
foreach ($cateList as $ckey => $cvalue) {
if($value['term_id'] == $cvalue['parent']){
$cateDatalist[$key]["c"][] = $cvalue;
}
}
}
//print_r($cateDatalist);
foreach ($cateDatalist as $key => $value) {
?>
<li class="cat-item"> <h2><a href="<?php echo get_category_link($value["cat_ID"]) ; ?>"> <?php echo $value["name"]; ?></a></h2> //一级目录
<?php
if($value['c']){
?>
<ul class="children">
<?php
foreach ($value['c'] as $vkey => $vvalue) {
?>
<li class="cat-item"><h3> <a href="<?php echo get_category_link($vvalue["cat_ID"]); ?>"> <?php echo $vvalue["name"]; ?></a> </h3></li>//二级分类
<?php
}
?>
</ul>
<?php
}
?>
</li>
<?php
}
?>
</ul>
</div>
<?php }?>
十、TKD标签集合
//首页
<title><?php bloginfo('name'); ?></title>
<meta name="keywords" content="<?php bloginfo('name'); ?>">
<meta name="description" content="">
//列表页
<title><?php single_cat_title(); ?>-<?php echo get_option('cat-title-'.$term_id);?>-<?php bloginfo('name'); ?></title>
<meta name="keywords" content="<?php single_cat_title(); ?>,<?php bloginfo('name'); ?>" />
<meta name="description" content="<?php echo category_description(); ?>" />
//详情页
<title><?php the_title(); ?>--<?php bloginfo('name'); ?></title>
<?php the_keywords();?>
<meta name="description" content="<?php the_excerpt();?>">
<title><?php echo trim(get_the_title()); ?>-<?php bloginfo('name'); ?></title>
<?php the_keywords();?>
<?php the_description();?>
//单页面
<title><?php the_title(); ?>-<?php bloginfo('name'); ?></title>
<meta name="keywords" content="<?php bloginfo('name'); ?>">
<meta name="description" content="">
//tag页
<title><?php single_cat_title(); ?>-<?php bloginfo('name'); ?></title>
<meta name="keywords" content="<?php single_cat_title(); ?>,<?php bloginfo('name'); ?>" />
<meta name="description" content="<?php echo category_description(); ?>" />
十一、其他标签
模板地址
<?php bloginfo('template_url'); ?>
网站首页地址
<?php bloginfo('url'); ?>
左侧浮动导航
//html
<div class="float_window">
<div class="float_window_rela">
<div class="float_window_close">+</div>
<div class="float_window_tt">Inquiry</div>
<form action="https://www.chromvials.com/data/post.php" method="post" onsubmit="this.url.value=window.location.href">
<input class="float_window_text" type="text" name="name" placeholder="Name">
<input class="float_window_text" type="text" name="email" placeholder="E-mail">
<textarea class="float_window_area" name="message" placeholder="message"></textarea>
<button class="float_window_btn" type="submit">
SUBMIT
</button>
</form>
</div>
</div>
//css
.float_window{
position: fixed;
left: 0;
bottom: 0;
z-index: 6;
width: 230px;
box-shadow:0 0 10px rgba(115,115,115,.2);
}
.float_window_rela{
padding: 20px;
background: #fff;
position: relative;
}
.float_window_close{
position: absolute;
right: -20px;
top: -20px;
font-size: 20px;
width: 20px;
height: 20px;
line-height: 20px;
text-align: center;
color: #fff;
cursor: pointer;
text-shadow: 0 0 5px rgba(0,0,0,.8);
transform: rotateZ(45deg);
-webkit-transform: rotateZ(45deg);
-ms-transform: rotateZ(45deg);
}
.float_window_tt{
font-size: 22px;
color: #333;
font-weight: bold;
text-align: center;
text-transform: uppercase;
margin-bottom:15px;
}
.float_window_text,
.float_window_area{
display: block;
width: 100%;
height: 36px;
font-size: 14px;
padding-left: 15px;
border: 1px solid #dedede;
background: none;
margin-bottom:10px;
}
.float_window_area{
height: 80px;
padding-top: 10px;
resize: none;
}
.float_window_btn{
display: block;
width: 150px;
height: 30px;
line-height: 30px;
color: #fff;
text-align: center;
background: #00b7ee;
border: none;
}
.float_window.hover{
left: -230px;
}
.float_window.hover .float_window_close{
transform: rotateZ(90deg);
-webkit-transform: rotateZ(90deg);
-ms-transform: rotateZ(90deg);
}
//Js
<script>
$(function(){
$(".float_window_close").click(function(){
$(".float_window").toggleClass("hover");
})
})
</script>
十二、新版使用说明
登陆后台
进入设置 ==》 常规设置
填写当前项目的一些资料,截图如下(图上的是帕菲特的数据)
Tagsid-* 这里填写的采集用的tags 根目录下采集入口文件夹命名必须是ID,里面的main.php 要用新的
关于logobase 打开 https://tool.lu/base64image/ 上传图片 使用下图中的Dataurl 即可
十三、注意事项
/etc/init.d/bt restart //重启宝塔的命令
根目录下采集入口文件夹命名必须是ID,里面的main.php 要用新的,
(1)上站必须排查robots, 不能禁止搜索引擎抓取,上线即开放收录入口;
(2)上线后网站内不能出现任何西维的标识,无用文件剔除,比如不用的主题,用不到的模板文件,模板中的无用代码,都可以删除掉;
(3)一切以表格为主, 上站立即完善站群表格信息,尤其上线时间,着陆页id及板式备注;
(4)上线之后,需要看sitemap设置是否正确,建议重新安装下插件,解决sitemap 的问题
(5)Tag.php Tag聚合页面必须做,可随机从网站内选取列表样式,每条记录描述要调出来
(6)所有列表页的每一条记录,展示部分描述,同时每一条下方要有触发按钮,按钮文字可以是Get Price, Inquiry Now, Quote Now
(7)404.php 404页面必须做
十四、模板制作标准
(1)着陆页命名如下:着陆页命名格式如下 single-1.php
四个着陆页 必须包含详情页
每个着陆页 需要H1
着陆页 要有留言入口标题、摘要、要注意跟之前不一样地方
列表页形式
<?php
$category = get_the_category();
$catId = $category[0]->cat_ID;
$dir="/wp-content/themes/".get_option("themeload")."/load/$catId/";
$content = replaceData($post->post_content);
$CJ = list_add_thumbs($content,$dir);
?>
详情页形式
<?php if(has_excerpt()): //如果有摘要就显示,没有就从文章中截取 ?>
<?php the_excerpt(); ?>
<?php else: ?>
<?php echo replaceData(mb_strimwidth(strip_tags(apply_filters('the_content',$post->post_content)),0,200,"..."));?>
<?php endif; ?>//摘要
<?php echo replaceData(get_the_content()); ?>//详情页的内容
(2)导航产品需要支持 二级下拉、案例和新闻(需要支持下拉)
(3)首页页需要包含产品、案例、新闻(最好都有描述)
(4)列表需要有描述(新闻列表的图片,需要用到第三项红色代码)列表页每一条记录下方必须有诱导按钮,Get Price, Quote Now, Inquiry Now ,Order Now
Get Price
(5)详情页需要 标题 摘要 、tag 诱导按钮 内容 留言薄 推荐产品
(6)Tag页面需要完成
(7)搜索删除
(8)不能出现其他公司的名字,其他的不用换
(9)不能出现西维支持
(10)全部实现动态调用、
(11).404页面必须有
(12)所有模板里面的title,必须包含调用站点主题名称即-
(13)lang=”en” 必须加上
(14)模板文件夹名命规则 (年月日-模板所属客户简称-模板线上网址)
(15)模板文件夹里需要包括 (d文件夹不需要banner 文件夹)