WordPress development help.

by endlesspsych

Hi I have a bit of code I need to alter (I think this is the correct bit).

If I am right this here chunk displays whatever is in the posts archive? Now what if I want to change that so it only displays one result (either the latest or the earliest)?

Also if possible it would be good if someone could show me if individual categories can be identified and subject to different behaviours re:display (though I suspect that could be a different widget).

<?php get_header(); ?>

<div id="content">
<?php arras_above_content() ?>

<?php is_tag(); if ( have_posts() ) : ?>
	<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>

	<?php if ( is_category() ) : ?>
        <h1><?php printf( __('%s', 'arras'), single_cat_title() ) ?></h1>
    <?php elseif ( is_tag() ) : ?>
        <h1><?php printf( __('%s Archive', 'arras'), single_tag_title() ) ?></h1>
	<?php elseif ( is_tax() ) : $term = $wp_query->get_queried_object(); ?>
		<h1><?php printf( __('%s Archive', 'arras'), $term->name ) ?></h1>
    <?php elseif ( is_day() ) : ?>
        <h1><?php printf( __('Archive for %s', 'arras'), get_the_time( __('F jS, Y', 'arras') ) ) ?></h1>
    <?php elseif ( is_month() ) : ?>
        <h1><?php printf( __('Archive for %s', 'arras'), get_the_time( __('F, Y', 'arras') ) ) ?></h1>
    <?php elseif ( is_year() ) : ?>
        <h1><?php printf( __('Archive for %s', 'arras'), get_the_time( __('Y', 'arras') ) ) ?></h1>
    <?php elseif ( is_author() ) : ?>
        <h1><?php _e('Author Archive', 'arras') ?></h1>
    <?php else : ?>
        <h1><?php _e('Archives', 'arras') ?></h1>
    <?php endif; ?>

	<div id="archive-posts">
	<?php arras_render_posts( null, arras_get_option('archive_display') ) ?>    

	<?php if(function_exists('wp_pagenavi')) wp_pagenavi(); else { ?>
    	<div>
			<div><?php next_posts_link( __('Older Entries', 'arras') ) ?></div>
			<div><?php previous_posts_link( __('Newer Entries', 'arras') ) ?></div>
		</div>
    <?php } ?>
	</div><!-- #archive-posts -->

<?php else : ?>
	<?php arras_post_notfound() ?>
<?php endif; ?>

<?php arras_below_content() ?>
</div><!-- #content -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>

Help greatly appreciated. (I appreciate I am probably a bit of an idiot for being unable to fathom this but I am on a short time scale 😦 )

More code here

Advertisements