https://www.cnblogs.com/huntaheart/p/3968385.html
去除页面顶部黑条:
show_admin_bar(false);
公共模块调取:
<?php include("workwith.php"); ?>
<?php get_header(); ?>
<?php get_footer(); ?>自定义文章详情页模板:
add_action('template_include', 'load_single_template');
function load_single_template($template) {
$new_template = '';
// single post template
if( is_single() ) {
global $post;
// 'wordpress' is category slugs
if( has_term('blog', 'category', $post) ) {
$new_template = locate_template(array('blog_detail.php' ));
}
}
return ('' != $new_template) ? $new_template : $template;
}文章详情页内容调取:
调用文章标题:<?php the_title(); ?> 调用文章内容:<?php the_content(); ?> 调用文章摘要:<?php the_excerpt(); ?> 调用作者姓名:<?php the_author(); ?> 调用文章发布时间:<?php the_time(); ?> <?php the_date_xml(); ?> 调用作者的Gravatar头像:<?php echo get_avatar( get_the_author_email(), 36 ); ?>
封面图(特色图片):
functions.php中加入:add_theme_support('post-thumbnails');

列表页面调取封面图:
<?php the_post_thumbnail(); ?> // 默认显示缩略图 the_post_thumbnail(‘thumbnail’); // 显示缩略图 the_post_thumbnail(‘medium’); // 显示中等尺寸 the_post_thumbnail(‘large’); // 显示大尺寸 the_post_thumbnail( array(200,200) ); // 自定义尺寸
特色图片调取路径,用于背景图:
<a href="/neighborhoods/upper-east-side" style="background-image: url(<?php $getThumbnail = wp_get_attachment_image_src( get_post_thumbnail_id(get_the_ID())); echo $getThumbnail[0]; ?>);">