ThemeShaper Forums » Thematic

[closed]

Index: First post in full, the next few as excerpts

(4 posts)
  • Started 4 years ago by rideearthtom
  • Latest reply from rideearthtom
  • This topic is not resolved
  1. rideearthtom
    Member

    I want to do something simple - display the most recent post on the index page in full, and the remaining ones below it as excerpts (including all posts in category/tag archives and on pages other than page 1 of the index page).

    From the normal content/excerpt manipulating functions I can't figure out how to do this - any ideas?

    Posted 4 years ago #
  2. johnhunter
    Member

    My approach was to create a custom version of the thematic_indexloop (from content_extensions.php) in child theme functions.php. In the custom loop you can set up a condition to output excerpts (usefully there is a count variable for the widget area). The following code will do what you require on the homepage:

    // Remove the default loop and replace with our custom 'full first' version.
    // Note: Based on Thematic 0.9.6.2
    function remove_thematic_index_loop() {
          remove_action ('thematic_indexloop','thematic_index_loop');
    }
    add_action('init','remove_thematic_index_loop');
    
    function fullfirst_index_loop () {
    	global $options;
    
    	foreach ($options as $value) {
        	if (get_option( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; }
        	else { $$value['id'] = get_option( $value['id'] ); }
        }
    
    	/* Count the number of posts so we can insert a widgetized area */ $count = 1;
    	while ( have_posts() ) : the_post() ?>
    
    		<div id="post-<?php the_ID() ?>" class="<?php thematic_post_class() ?>">
       			<?php thematic_postheader(); ?>
    			<div class="entry-content"><?php 
    
    				if (is_home() || is_front_page() and $count > 1) {
    					echo apply_filters('thematic_post', get_the_excerpt());
    				}
    				else {
    					thematic_content();
    				}
    
    			?>
    			<?php wp_link_pages('before=<div class="page-link">' .__('Pages:', 'thematic') . '&after=</div>') ?>
    			</div>
    			<?php thematic_postfooter(); ?>
    		</div><!-- .post -->
    
    			<?php comments_template();
    
    			if ($count==$thm_insert_position) {
    					get_sidebar('index-insert');
    			}
    			$count = $count + 1;
    	endwhile;
    }
    add_action('thematic_indexloop', 'fullfirst_index_loop');
    Posted 4 years ago #
  3. rideearthtom
    Member

    This works, except that the full first post of a given page is also shown on pages other than page 1... any ideas?

    Posted 4 years ago #
  4. rideearthtom
    Member

    OK - I changed the conditionals to this:

    if ((is_home() || is_front_page()) && ($count > 1 || is_paged())) {

    Posted 4 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.