网站代码加密,做二手的网站有哪些,wordpress 二级侧边栏,网页设计的代码1、get_template_part()函数用法
get_template_part()函数的使用很灵活#xff0c;不仅仅是加载一个模板文件进来#xff0c;而且还有备用的选项#xff0c;调用代码如下#xff1a;
?php get_template_part( $slug, $name ); ?
参数:
$slug (必须) 通用的模…1、get_template_part()函数用法
get_template_part()函数的使用很灵活不仅仅是加载一个模板文件进来而且还有备用的选项调用代码如下
?php get_template_part( $slug, $name ); ?
参数:
$slug (必须) 通用的模板名
$name (可选) 指定的模板名
什么意思呢我们来看一下具体的示例
?php get_template_part( content, blog ); ?
意思是说如果content-blog.php存在则调用content-blog.php否则就调用content.php
2、首页摘要字数控制
方法一找到content.php文件并打开他找到the_content()这个函数定位到那个位置之后将下面代码插入
?php if(is_category() || is_archive() || is_home() ){the_excerpt();}else{the_content( __( Continue reading span classmeta-navrarr;/span, twentytwelve ) );} ?
然后将刚刚查询到的the_content()函数中的代码替换到上方代码中的the_content()
方法二
或者 ?php the_content(); ?
修改为 ?php the_excerpt(); ?
方法三
formatting.php文件然后找到这行代码$excerpt_length 55;