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打开速度非常慢的解决办法》的一些看法。更多内容请查看本栏目更多内容!
1、在仪表盘增加子菜单: add_submenu_page( 'index.php', … ); 2、在文章处增加子菜单: add_submenu...
register_sidebar()(创立侧边栏) 建设一个侧边栏,用来搁置小工具。这个函数应用的时分请放在一个函数里,...
明天在修正网站的时分,不小心把最新版Wordpress3.5.1的wp-includes目录下的functions.php笼罩出来了,招致...
WordPress在后盾编辑日志时编辑框左下角有一个字数统计,不过只显示在后盾,能不能在前台也加上文章字数统计...
然而固定衔接假如不必postid命名的话兴许发现不了,然而大葱不断应用的就是这种固定链接。假如你网速不佳的...
首先到Flash MP3 Player 的主页上下载该顺序。解紧缩之后,将 mp3player.swf 和 ufo.js 两个文件放到效劳器...