我很好奇,因为我需要对index.php清单中显示的每篇博客文章的代码标记进行一些修改。
我不是指像the_post()这样的东西,我想看到的是输入原始html的最低级别函数。有一行html,我需要追加到我所有的博客,使谷歌作者的工作。
我得到警告:缺少必填字段"已更新"。在丰富的代码片段工具中。不幸的是,没有插件服务于此。
这是我的主题的index.php看起来像现在:
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', ( post_type_supports( get_post_type(), 'post-formats' ) ? get_post_format() : get_post_type() ) ); ?>
<?php endwhile; ?>
<?php else : ?>
<?php get_template_part( 'loop-error' ); // Loads the loop-error.php template. ?>
?php endif; ?>
这是content.php的相关部分
<div id="post-<?php the_ID(); ?>" class="<?php hybrid_entry_class(); ?>">
<div class="post-content">
<?php echo apply_atomic_shortcode( 'entry_title', '[entry-title permalink="0"]' ); ?>
<?php echo apply_atomic_shortcode( 'byline', '<div class="byline">' . __( '[entry-published] · by [entry-author] · in [entry-terms taxonomy="category" before=""] [entry-edit-link before=" · "]', 'ascetica' ) . '</div>' ); ?>
<div class="entry-content">
<?php the_content(); ?>
<?php wp_link_pages( array( 'before' => '<p class="page-links">' . __( 'Pages:', 'ascetica' ), 'after' => '</p>' ) ); ?>
</div><!-- .entry-content -->
<?php echo apply_atomic_shortcode( 'entry_meta', '<div class="entry-meta">' . __( '[entry-terms taxonomy="post_tag" before="Tags: "]', 'ascetica' ) . '</div>' ); ?>
<?php do_atomic( 'close_entry' ); // ascetica_close_entry ?>
</div><!-- .post-content -->
</div><!-- .hentry -->
谢谢。
默认情况下,themes index.php文件直接从循环内部处理这些。你的主题可能会有些不同。这是WordPress模板文件层次结构的可视化http://codex.wordpress.org/images/1/18/Template_Hierarchy.png