最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - Show full posts in archive

programmeradmin0浏览0评论

I have an issue where I need to display the full posts in my archive page.

E.G. I have >two posts and I would like to have EACH of them displayed in full in the archive page. Thanks!

How would I do this with the hueman theme?

Here is the contents of the archive.php theme:

<?php get_header(); ?>

<section class="content">

    <?php get_template_part('inc/page-title'); ?>
    <?php if(function_exists('pf_show_link')){echo pf_show_link();} ?>
    <div class="pad group">     

        <?php if ((category_description() != '') && !is_paged()) : ?>
            <div class="notebox">
                <?php echo category_description(); ?>
            </div>
        <?php endif; ?>

        <?php if ( have_posts() ) : ?>

            <div class="post-list group">
                <?php $i = 1; echo '<div class="post-row">'; while ( have_posts() ): the_post(); ?>
                <?php get_template_part('content'); ?>
                <?php if($i % 2 == 0) { echo '</div><div class="post-row">'; } $i++; endwhile; echo '</div>'; ?>
            </div><!--/.post-list-->

            <?php get_template_part('inc/pagination'); ?>

        <?php endif; ?>

    </div><!--/.pad-->

</section><!--/.content-->

<?php get_sidebar(); ?>

<?php get_footer(); ?>

Here is the content.php file:

" >

    <div class="post-thumbnail">
        <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
            <?php if ( has_post_thumbnail() ): ?>
                <?php the_post_thumbnail('thumb-medium'); ?>
            <?php elseif ( ot_get_option('placeholder') != 'off' ): ?>
                <img src="<?php echo get_template_directory_uri(); ?>/img/thumb-medium.png" alt="<?php the_title(); ?>" />
            <?php endif; ?>
            <?php if ( has_post_format('video') && !is_sticky() ) echo'<span class="thumb-icon"><i class="fa fa-play"></i></span>'; ?>
            <?php if ( has_post_format('audio') && !is_sticky() ) echo'<span class="thumb-icon"><i class="fa fa-volume-up"></i></span>'; ?>
            <?php if ( is_sticky() ) echo'<span class="thumb-icon"><i class="fa fa-star"></i></span>'; ?>
        </a>
        <?php if ( comments_open() && ( ot_get_option( 'comment-count' ) != 'off' ) ): ?>
            <a class="post-comments" href="<?php comments_link(); ?>"><span><i class="fa fa-comments-o"></i><?php comments_number( '0', '1', '%' ); ?></span></a>
        <?php endif; ?>
    </div><!--/.post-thumbnail-->

    <div class="post-meta group">
        <p class="post-category"><?php the_category(' / '); ?></p>
        <p class="post-date"><?php the_time('j M, Y'); ?></p>
    </div><!--/.post-meta-->

    <h2 class="post-title">
        <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a>
    </h2><!--/.post-title-->

    <?php if (ot_get_option('excerpt-length') != '0'): ?>
    <div class="entry excerpt">             
        <?php the_excerpt(); ?>
    </div><!--/.entry-->
    <?php endif; ?>

</div><!--/.post-inner-->   

Thanks for your interest!

I have an issue where I need to display the full posts in my archive page.

E.G. I have >two posts and I would like to have EACH of them displayed in full in the archive page. Thanks!

How would I do this with the hueman theme?

Here is the contents of the archive.php theme:

<?php get_header(); ?>

<section class="content">

    <?php get_template_part('inc/page-title'); ?>
    <?php if(function_exists('pf_show_link')){echo pf_show_link();} ?>
    <div class="pad group">     

        <?php if ((category_description() != '') && !is_paged()) : ?>
            <div class="notebox">
                <?php echo category_description(); ?>
            </div>
        <?php endif; ?>

        <?php if ( have_posts() ) : ?>

            <div class="post-list group">
                <?php $i = 1; echo '<div class="post-row">'; while ( have_posts() ): the_post(); ?>
                <?php get_template_part('content'); ?>
                <?php if($i % 2 == 0) { echo '</div><div class="post-row">'; } $i++; endwhile; echo '</div>'; ?>
            </div><!--/.post-list-->

            <?php get_template_part('inc/pagination'); ?>

        <?php endif; ?>

    </div><!--/.pad-->

</section><!--/.content-->

<?php get_sidebar(); ?>

<?php get_footer(); ?>

Here is the content.php file:

" >

    <div class="post-thumbnail">
        <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
            <?php if ( has_post_thumbnail() ): ?>
                <?php the_post_thumbnail('thumb-medium'); ?>
            <?php elseif ( ot_get_option('placeholder') != 'off' ): ?>
                <img src="<?php echo get_template_directory_uri(); ?>/img/thumb-medium.png" alt="<?php the_title(); ?>" />
            <?php endif; ?>
            <?php if ( has_post_format('video') && !is_sticky() ) echo'<span class="thumb-icon"><i class="fa fa-play"></i></span>'; ?>
            <?php if ( has_post_format('audio') && !is_sticky() ) echo'<span class="thumb-icon"><i class="fa fa-volume-up"></i></span>'; ?>
            <?php if ( is_sticky() ) echo'<span class="thumb-icon"><i class="fa fa-star"></i></span>'; ?>
        </a>
        <?php if ( comments_open() && ( ot_get_option( 'comment-count' ) != 'off' ) ): ?>
            <a class="post-comments" href="<?php comments_link(); ?>"><span><i class="fa fa-comments-o"></i><?php comments_number( '0', '1', '%' ); ?></span></a>
        <?php endif; ?>
    </div><!--/.post-thumbnail-->

    <div class="post-meta group">
        <p class="post-category"><?php the_category(' / '); ?></p>
        <p class="post-date"><?php the_time('j M, Y'); ?></p>
    </div><!--/.post-meta-->

    <h2 class="post-title">
        <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a>
    </h2><!--/.post-title-->

    <?php if (ot_get_option('excerpt-length') != '0'): ?>
    <div class="entry excerpt">             
        <?php the_excerpt(); ?>
    </div><!--/.entry-->
    <?php endif; ?>

</div><!--/.post-inner-->   

Thanks for your interest!

Share Improve this question edited Apr 17, 2014 at 23:16 Elliot Huffman asked Apr 17, 2014 at 18:09 Elliot HuffmanElliot Huffman 1299 bronze badges 13
  • 2 What have you tried so far? What relevant template files does your Theme include? – Chip Bennett Commented Apr 17, 2014 at 18:18
  • I have tried using the <?php the_content(); ?> php code snip bit but that only shows the full most recent post. – Elliot Huffman Commented Apr 17, 2014 at 18:25
  • the_content() is the correct function, so you must not have it in the right place. Not familiar with the theme to correct you, but agree with Pieter's suggestion of a child theme. – helgatheviking Commented Apr 17, 2014 at 19:42
  • I will post the content of the archive.php file in the question – Elliot Huffman Commented Apr 17, 2014 at 21:25
  • The archive.php code you posted doesn't call either the_content() or the_excerpt(). You probably need to look in content.php, which is included in archive.php via get_template_part( 'content' ). – Chip Bennett Commented Apr 17, 2014 at 22:38
 |  Show 8 more comments

1 Answer 1

Reset to default 1

You need to do the following in a child theme, do not make changes to the theme itself.

EDIT

I had a good look at the 'Heuman' theme. I think to solve your problem here is to copy the following files to your child theme, content.php and archive.php

Rename your content.php to something like content-archive.php. Open it up and delete the following lines

<?php if (ot_get_option('excerpt-length') != '0'): ?>
 <div class="entry excerpt">                
   <?php the_excerpt(); ?>
 </div><!--/.entry-->
<?php endif; ?>

and replace it with

<div class="entry content">             
   <?php the_content(); ?>
</div><!--/.entry-->

Next, open up your archive.php and replace he following line

<?php get_template_part('content'); ?>

with

<?php get_template_part('content', 'archive'); ?>

That should solve your problem

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论