function extra_assets() {
if(is_page(666)) { // '666' 就是您心愿添加css和js的页面id
wp_enqueue_script('my-script', get_template_directory_uri().'/js地址');
wp_enqueue_style('my-style', get_template_directory_uri().'/css地址');
}
}
add_action('wp_head','extra_assets');
function more_from_category($cat_ID) {
if(in_category($cat_ID) {
$posts = get_posts('numberposts=5&category='.$cat_ID);
$output = '<h3>More from this category</h3>';
$output.= '<ul>';
foreach($posts as $post) {
$output.= '<li><a href="'.get_the_title().'">'.get_permalink.'</a></li>';
}
wp_reset_query();
$output.= '</ul>';
echo $output;
}
}
function preview_warning() {
if(is_preview()) {
echo '<p id="preview-warning">Remember, you\'re still on the Preview page!<p>';
}
}
add_action('the_content','preview_warning');
#preview-warning {
background:#800;
line-height:50px;
font-size:30px;
font-weight:bold;
text-align:center;
position:fixed;
bottom:0;
}
if(is_date()) {
//h2能够修正的。.
echo '<h2>'.the_title().'</h2>';
} else {
// ...
// else外面的代码就是您archive.php里的循环代码了。
// ...
}
function admin_favicon() {
if(is_admin()) {
echo '<link rel="shortcut icon" href="'.get_bloginfo('url').'/adminfav.ico" />';
}
}
add_action('admin_head','admin_favicon');
以上就是安达网络工作室关于《WordPress打开速度非常慢的解决办法》的一些看法。更多内容请查看本栏目更多内容!
什么是模板呢?默许状况 WordPress是应用主标题录下page.php来作为模板显示页面的,然而有时分咱们需求不同...
在 PHP 中发送 Http 申请(GET / POST)有很多的办法,比方 file_get_contents() 函数、fopen() 函数或许 c...
WordPress是一个经典而又弱小的博客顺序,并且易于装置与搭建,在OpenShift上不花半分钟就能够收费建起一个...
最近忽然发现博客的评论楼层有点成绩,之前不断设置的是“在每个页面顶部显示新的评论”,也就是所谓的倒序...
WordPress 上获取文章最重要的就是循环(Loop),现实上循环就是去数据库查问到相应的文章,而后临时贮存到...
wordpress能够设置自定义字段,不便扩大性能,wordpress利用巧妙的数据库表设计达到这一目的,posts表寄存文...