WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Twenty eleven mod: show full text on home/index page (3 posts)

  1. Mrmark
    Member
    Posted 3 years ago #

    I'm using Twenty Eleven which has no real index page but seems to look to content.php to decide how to display posts. I've put in the <more> tag in all of my articles and now I want to show full-text on the main page only but can't seem to find it.

    On my child them content.php I excised the code after the snippet <?php the_content(); ?> and the line following it in order not to show the 'more' link. But it seems not to affect the display.

    -Am I working on the right file? It's the content.php in my child folder, copied from the Twenty Eleven theme folder.

    Ideally I'd like to show full text for the first 5 or so main page posts, then summaries/excerpts for another five or whatever. So if there's an appropriate conditional to include, I'd really appreciate knowing.

    I thought I'd find this answer straight away, and saw some general replies on it, but not for the Twenty Eleven theme evidently.

    Thanks much....

  2. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    I've put in the <more> tag in all of my articles and now I want to show full-text on the main page only but can't seem to find it.

    http://codex.wordpress.org/Customizing_the_Read_More#More_about_.24more

    the above example is for the first post; to stretch it to 5 posts, you need to check the $wp_query->current_post in a conditional statement.

    example - locate this section in content.php:

    </header><!-- .entry-header -->
    
    		<?php if ( is_search() ) : // Only display Excerpts for Search ?>
    		<div class="entry-summary">

    after the changes:

    </header><!-- .entry-header -->
    <?php global $more; if( $wp_query->current_post <= 4 && !is_paged() ) { $more = -1; } else { $more = 1; }  ?>
    		<?php if ( is_search() || $wp_query->current_post > 4 || is_paged() ) : // Only display Excerpts for Search ?>
    		<div class="entry-summary">

    this hopefully shows the first five posts in full - regardless of the more tag - and any following posts as excerpts; and exerpts only on paginated pages.
    if the general idea is also supposed to happen on the paginated pages, remove the is_paged() part from the conditionals.

  3. Mrmark
    Member
    Posted 3 years ago #

    Hello @alchymyth -

    Thanks again for the quick reply. Again, works like a charm.

    I had not thought to look to the codex for the read more tag (thanks!). I didn't guess it went to he fine-grain of 'read more.' (I come from Joomla!). Documentation for WP is so good and easy to use; wordpress.org is a first-class setup.

Topic Closed

This topic has been closed to new replies.

About this Topic