WordPress.org

Ready to get started?Download WordPress

Forums

Seriously Simple Podcasting
[resolved] Custom Posts Per Page in Template (3 posts)

  1. Anticrombie
    Member
    Posted 1 year ago #

    I'm hoping this is a simple response, I'm just not familiar with how the plugin is querying the posts (custom taxonomy?)

    How can I add a 'posts_per_page=10' to the 'archive-podcast.php' so the archive page will show the latest 10 podcasts?

    Here is the loop as I have it now:

    <?php if ( have_posts() ) : ?>
        <?php $feed_link = get_post_type_archive_feed_link( 'podcast' );?>
         <header>
            <h1 class="page-title" itemprop="headline"><?php _e( 'Sermons' , 'ss-podcasting' ); ?></h1>
         </header>
         <section>
              <?php while (have_posts()) : the_post();?>
              <?php $terms = wp_get_post_terms( get_the_ID() , 'series' );
    		foreach( $terms as $term ) {
    			$series_id = $term->term_id;
    			$series = $term->name;
    			break;
    			}
    	   ?>
    	   <article class="podcast_episode">
                    <h3><time class="updated" datetime="<?php echo the_time('Y-m-j'); ?>" pubdate><?php the_time('F jS, Y'); ?></time> - <img src="<?php bloginfo('template_directory');?>/icons/microphone.png" width="26" height="23" alt="Sermon">
    		<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
    		<div class="podcast_meta"><?php echo $series; ?><aside></div>
    		</h3>
    	     </article>
                 <?php endwhile; ?>
    	</section>
    <?php endif; ?>

    Thanks in advance for any help you can give.

    http://wordpress.org/extend/plugins/seriously-simple-podcasting/

  2. Hugh Lashbrooke
    Member
    Plugin Author

    Posted 1 year ago #

    The archive page uses WP's main query loop, so the amount of episodes shown is taken from the amount of blog posts you have set to show per page in Settings > Reading. If you would like to edit it though, you can use the pre_get_posts filter - that's the correct way to edit the main loop on any given page. When using it just make sure it only triggers on the archive page for the podcast post type by using is_post_type_archive( 'podcast' ).

  3. Anticrombie
    Member
    Posted 1 year ago #

    Perfect! 'is_post_type-archive' is exactly what I needed.

    Cheers!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.