【WordPress】WordPress常用标签大全(一)
所属分类:Wordpress 1,978 次浏览
- 网站名称
<?php bloginfo(‘name’); ?>
2.网站url
<?php bloginfo(‘url’); ?>
3. favicon图标
<link rel=”shortcut icon” href=”<?php bloginfo(‘url’); ?>/favicon.ico”>
4. 样式文件路径调用
<?php bloginfo(‘template_url’); ?>/style/style.css
5. 调用头部文件
<?php get_header(); ?>
6. 调用footer底部文件
<?php get_footer(); ?>
7. 调用侧边栏(系统默认)
<?php get_sidebar(); ?>
8. 调用评论
<?php comments_template();?>
9. 顶部导航调用(需要配合后台菜单设置)
<?php if ( function_exists( ‘wp_nav_menu’ ) ){
wp_nav_menu( array( ‘theme_location’ => ‘top-links’, ‘container_id’ => ‘topLinks’, ‘fallback_cb’=>’toplinks’) );
}else{
toplinks();
}?>
10. 调用自定义模板
<?php include (TEMPLATEPATH . ‘/Micahel.php’); ?>
11. 调用上一篇下一篇
<strong>Last Article</strong>: <strong>Last Article</strong>:
<p style=”color:#F00″>
<?php$prev_post = get_previous_post();if (!empty( $prev_post )): ?><a title=”<?php echo $prev_post->post_title; ?>” href=”<?php echo get_permalink( $prev_post->ID ); ?>”><?php echo $prev_post->post_title; ?></a><?php endif; ?>
</p>
<br/>
<strong>Next Article:</strong>
<p style=”color:#F00″>
<?php$next_post = get_next_post();if (!empty( $next_post )): ?><a title=”<?php echo $next_post->post_title; ?>” href=”<?php echo get_permalink( $next_post->ID ); ?>”><?php echo $next_post->post_title; ?></a><?php endif; ?>
</p>