0

i want to show the full posts in category archive page, i put the_content() in the category template (content.php)

<article id="post-<?php the_ID(); ?>" <?php post_class( 'entry' ); ?><?php echo et_fable_get_background(); ?>>
    <div class="container clearfix">
        <header class="entry-title">
        <?php if ( is_single() ) : ?>
            <h1><?php the_title(); ?></h1>
        <?php else : ?>
            <h2>
                <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
            </h2>
        <?php endif; ?>

            <?php //et_fable_post_meta(); ?>
        </header>

    <?php if ( ! is_single() ) : ?>
        <div class="entry-content clearfix">
            <p><?php truncate_post( 900 ); ?></p>
        </div> <!-- .entry-content -->
        <?php the_content(); ?>
        <footer class="entry-footer">
            <a href="<?php the_permalink(); ?>" class="read-more"><span><?php esc_html_e( 'Read More', 'Fable' ); ?></span></a>
        </footer>

    <?php endif; ?>

    </div> <!-- .container -->

    <?php if ( is_single() ) : ?>
        <?php get_template_part( 'includes/share', get_post_format() ); ?>
    <?php endif; ?>
</article> <!-- .entry-->

the_content() not display full post in content.php, but in single.php (the details content page), it shows the full post, i'm wondering why same code not displaying the same thing

  • I think you want to replace <p><?php truncate_post( 900 ); ?></p> with <?php the_content(); ?>. – Milo Nov 9 '15 at 2:28
  • i had tried, not work. – hkguile Nov 9 '15 at 2:32
  • are you sure your category archive template loads content.php? – Milo Nov 9 '15 at 2:34
  • yes sure, i had tried comment out something, it will not display – hkguile Nov 9 '15 at 2:39
  • i had tried replace the truncated into "global $more; $more = 1; the_content(); ", but it will show "read more" link – hkguile Nov 9 '15 at 3:18
0

Try this

     <?php global $post; ?>
        <article id="post-<?php the_ID(); ?>" <?php post_class( 'entry' ); ?><?php echo et_fable_get_background(); ?>>
            <div class="container clearfix">
                <header class="entry-title">
                <?php if ( is_single() ) : ?>
                    <h1><?php the_title(); ?></h1>
                <?php else : ?>
                    <h2>
                        <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
                    </h2>
                <?php endif; ?>

                    <?php //et_fable_post_meta(); ?>
                </header>

            <?php if ( ! is_single() ) : ?>
                <div class="entry-content clearfix">
                    <p><?php truncate_post( 900 ); ?></p>
                </div> <!-- .entry-content -->
                <?php //This is page id or post id
        $content_post = get_post($post->ID);
        echo $content = $content_post->post_content;

         ?>
                <footer class="entry-footer">
                    <a href="<?php the_permalink(); ?>" class="read-more"><span><?php esc_html_e( 'Read More', 'Fable' ); ?></span></a>
                </footer>

            <?php endif; ?>

            </div> <!-- .container -->

            <?php if ( is_single() ) : ?>
                <?php get_template_part( 'includes/share', get_post_format() ); ?>
            <?php endif; ?>

<?php echo apply_filters('the_content', $post->post_content); ?>



        </article> <!-- .entry-->
  • forgot some code please check my update code Add <?php echo apply_filters('the_content', $post->post_content); ?> it to that loop too – maddog Nov 10 '15 at 11:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.