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打开速度非常慢的解决办法》的一些看法。更多内容请查看本栏目更多内容!
single_cat_title()函数 single_cat_title()函数,日常中咱们很少会用到,但这个函数会给咱们处理很多成绩,...
繁忙了n天,我的wordpress终于挂到了公网上,开端内侧,不过呈现了成绩,下面一切的链接,不论是本人博客中...
这里选取的例子,便是 WordPress 中比拟有名的丑化超链接Title成果,普通的 title 成果是把鼠标放到 a 元素...
header_image() header_image() 函数是 WordPress 自定顶部图像的规范接口函数,该函数能够主动判别后盾设置...
WORDPRESS博客站曾经运转快一年了,在伪动态上不断很纠结,空间默许不支持伪动态,网上找了很多办法,用404...
1、wp_nav_menu()函数引见:worpdress倒退到3.0当前添加了一个自定义菜单函数wp_nav_menu(),使得wordpress...