• Resolved clever_name

    (@clever_name)


    Hello ??

    Any help will be appreciated.

    I have a site that uses the most recent post the_content on the homepage/front page.

    I used this code to allow the_content on the homepage/front page and the_excerpt on the archive/cat/search page results and put this in my temlate-parts/content.php child theme files.

    https://dailydose.rankubator.com

    <div class="entry-content">
    		<?php
              if ( is_home() ) {
    			/* translators: %s: Name of current post */
    			the_content( sprintf(
    				__( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentysixteen' ),
    				get_the_title()
    			) );
    
                   } else { 
    
    			the_excerpt( sprintf(
    				__( 'Continue reading<span class="screen-reader-text"> "%s"</span>', 'twentysixteen' ),
    				get_the_title()
    			) );
                   }
    
    			wp_link_pages( array(
    				'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentysixteen' ) . '</span>',
    				'after'       => '</div>',
    				'link_before' => '<span>',
    				'link_after'  => '</span>',
    				'pagelink'    => '<span class="screen-reader-text">' . __( 'Page', 'twentysixteen' ) . ' </span>%',
    				'separator'   => '<span class="screen-reader-text">, </span>',
    			) );
    		?>
    	</div><!-- .entry-content -->

    My issue is that the reading settings have to be set to 1 post to be displayed for my homepage/front page which I want to show the most current post and to have previous and next buttons functionality.

    This also forces the archive results pages, category etc to show only 1 excerpt.

    Is there a code that I can implement here to show 6 posts on just the archive/category etc?

    <?php query_posts('post_type=post&cat=3&showposts=5'); ?>
    		<?php while ( have_posts() ) : the_post(); ?>

    Something like this? If so where does it go?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter clever_name

    (@clever_name)

    Sorry, my child theme is based off of twenty sixteen. Thank you!

    Thread Starter clever_name

    (@clever_name)

    I have done this:

    With the Settings->Reading Blog pages show at most at 5, using the WordPress Default theme, in wp-content/themes/default/index.php, just before this line: <?php if (have_posts()) : ?>

    add this to cause one (1) post on the ‘index’ posts display:

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('showposts=1&paged='.$paged);
    
    ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Show multiple excerpts on archive pages & NOT homepage’ is closed to new replies.