簡體   English   中英

WordPress在哪個.php文件中打印出index.php上的博客標題,日期和作者(主要博客列表)

[英]In which .php file does wordpress print out the blog titles, dates, authors on index.php (main blog listing)

我很好奇,因為我需要對index.php列表中每個顯示的博客文章的代碼標記進行一些修改。

我不是說the_post()之類的東西,我想看看輸入原始html的最低級別的函數。 我需要在所有博客上附加一行html,這樣Google的作者身份才能起作用。

我收到警告:缺少必填字段“已更新”。 在豐富摘錄工具中 遺憾的是,沒有插件可以提供此服務。

這是我主題的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] &middot; by [entry-author] &middot; in [entry-terms taxonomy="category" before=""] [entry-edit-link before=" &middot; "]', '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 -->

謝謝。

默認情況下,主題index.php文件直接從循環內部處理這些主題。 您的主題可能有所不同。 這是WordPress模板文件層次結構的外觀http://codex.wordpress.org/images/1/18/Template_Hierarchy.png

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM