• Hi,
    I would like have the following features in my blog. Hope the experts here can guide me with the script.

    I want the first 2 posts in home, page 2,4,5, so on, category page to have full articles (without “more” tag) and the rest of the posts with more tag automatically added at the place with 2 lines.

    Meaning that the first 2 posts, the reader doesn’t need to click read more but the rest of the post in the page, they will have to click “read more”. I have 10 posts in each page and category page.

    Please advise.

    Thanks in advance.

Viewing 7 replies - 1 through 7 (of 7 total)
  • general info:

    if you are using a standard loop, then try something like this within the loop (to replace the existing <?php the_content(); ?> or <?php the_excerpt(); ?> within the templates of the index page and archive pages (index.php, archive.php, category.php etc …?):

    <?php if( $wp_query->current_post <= 1 ) :
    the_content();
    else :
    the_excerpt();
    endif; ?>
    Thread Starter akira01

    (@akira01)

    Hi Alchymyth,
    It doesn’t work as what I want. Sorry, maybe my explanation is not clear enough. Let me elaborate the actual scenario.

    I have 10 posts in every page (front-page1, page2, page3 and so on). Each post will have 2 lines break that I intend to have the read more to show up. As such, I would like to modify the script to have only the first 2 posts in every page to show full posts and the rest of the 8 posts to show excerpt with “read more” at the 2 lines-break.

    In other word
    Page 1 – Post 1 and 2 = full article and post 3 to 10 = excerpt
    Page 2 – Post 11 & 12 – full article and post 13 to 20 = excerpt

    Please advise. Thanks in advance.

    http://codex.wordpress.org/Function_Reference/the_content
    http://codex.wordpress.org/Function_Reference/the_content#Overriding_Archive.2FSingle_Page_Behavior

    possibly try:

    <?php if( $wp_query->current_post <= 1 ) :
    global $more; $more = 1;
    the_content();
    else :
    global $more; $more = 0;
    the_content('read more');
    endif; ?>
    Thread Starter akira01

    (@akira01)

    Hi alchymyth,
    It doesn’t work. I’ve gone through the link you provide but it doesn’t specify something like mine. I tried google and can’t get an answer as well. If you or anyone here happen to come out with the code, please let me know.

    Thanks

    and the rest of the 8 posts to show excerpt with “read more” at the 2 lines-break.

    do you add the ‘more tag’ within the posts (when writing or editing them) ?

    this would be needed for the suggested code to work.

    – or is your question, how to automatically add a ‘read-more’ after two paragraphs?

    Thread Starter akira01

    (@akira01)

    Hi,
    No, I don’t have the more tag added to all the 10 posts. I want the tag to be added automatically at the area with 2 line breaks.

    Thanks. Really appreciate for your valuable time to help me out.

    Thread Starter akira01

    (@akira01)

    Hi, by the way, your script posted earlier works if I add the more in every posts. No need to think of other code. I’ll use the code you have provided earlier.

    Thank you so much for your help in solving my problem.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘More Tag’ is closed to new replies.