0

我的客户希望他的新闻页面在页面上有 3 列和 3 个帖子。

每一栏都有标题名称、日期、摘录和阅读更多功能。

像这样:http ://rikvandoorn.nl/nieuws_pagina.jpg

因为我的 PHP 知识不是很好,我一直在寻找一些教程来创建 3 列页面。但是所有这些教程都已过时,缺乏信息,或者它们似乎效果不佳。

并且“留下回复”可以移动到single.php。

所以我希望你们中的一些人能给我一些帮助。

这是我当前的 content.php

<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
        <div class="aside">
            <h1 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
            <div class="entry-content">
                <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentytwelve' ) ); ?>
            </div><!-- .entry-content -->
        </div><!-- .aside -->

        <footer class="entry-meta">
            <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php echo get_the_date(); ?></a>
            <?php if ( comments_open() ) : ?>
            <div class="comments-link">
                <?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentytwelve' ) . '</span>', __( '1 Reply', 'twentytwelve' ), __( '% Replies', 'twentytwelve' ) ); ?>
            </div><!-- .comments-link -->
            <?php endif; // comments_open() ?>
            <?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?>
        </footer><!-- .entry-meta -->
    </article><!-- #post -->
4

1 回答 1

0

设置 wordpress循环

<?php if ( have_posts() ) :  while ( have_posts() ) : the_post();?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
        <div class="aside">
            <h1 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
            <div class="entry-content">
                <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentytwelve' ) ); ?>
            </div><!-- .entry-content -->
        </div><!-- .aside -->
            <?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?>
    </article><!-- #post -->
<?php endwhile; endif; wp_reset_query(); ?>

然后在管理员中转到设置>常规>阅读-在“博客页面最多显示”中选择3

于 2013-07-09T00:06:23.757 回答