• Resolved Garrett Cobarr

    (@garrett-cobarr)


    I am utterly new to WordPress, in fact, this is my first post in the forums. When I decided to use WordPress for my site, an essay portal, I thought I would just dive in and see how far I could go before I really and truly ran aground. To the great credit of WordPress and the community that surounds it, I got pretty far. My site is almost done but I am now thoroughly stuck, I think more due to my lack of knowledge about PHP and CSS than WordPress, but maybe not.

    I started with a Woo theme named Canvas and banged on it really hard until it does not look much like the original theme. I have modified the CSS substantially, even got brave enough to take several runs at the PHP under the hood. Sadly, I have met the edge of my current knowledge.

    My problem is a design/publication problem. As the site is currently setup I have 10 summary/teasers on the front page, most recent at the top of page, pretty standard stuff. http://www.wholethinking.com

    Each new essay contains an illustration at its front, top left corner, an example. I know how to control both the number of summaries and the amount of words per summary on the front page. What I would like and do not know how to setup is an expanded summary for the most recent essay. So whatever was the most recent essay, its summary, would be on the front page top with the illustration and more words. The moment its older, it would be come like the standard summary, and so on.

    I apologize for any confusion, I do know the technical difference between teaser, summary and excerpt, I am just not sure how to describe this situation.

    I have done a lot of reading about the_excerpt(), the_content() and more and think this where the magic lies but I do not have enough knowledge/experience to pull this off.

    I would really appreciate any guidance and I am willing to pull my own weight. Thanks for any help.

Viewing 11 replies - 1 through 11 (of 11 total)
  • A simple if/else conditional within the recent posts Loop should do it. Not sure what your current code looks like (if you do want to post it, please use a pastebin) but something along the lines of:

    <?php $c= 0;if (have_posts()) : while (have_posts()) : the_post();$c++; ?>
    [ post heading code ]
    <?php if($c == 1 ) the_content;
    else the_except();?>

    should work.

    Thread Starter Garrett Cobarr

    (@garrett-cobarr)

    Esmi, much thanks!

    My minimal PHP experience does hinder me. The theme has a host of PHP files, which one would I look inside or should I do a search for a specific term across files?

    Once I locate that file I would be happy to paste.

    The page you linked to is a single post, so I’m not exactly sure how these summaries are used. Can you elaborate on them? I may have misunderstood your original question.

    Thread Starter Garrett Cobarr

    (@garrett-cobarr)

    The first link is the front page, showing the summaries of the 10 most recent essays. The 2nd link is showing one of those essays, I gave that as an example to show the content I would like shown in an extended summary of the most recent essay. Only the most recent essay summary would show the illustration and the extended text excerpt.

    Does that make sense?

    I do write code: Javascript, Actionscript, so I am familiar with loops, booleans, arrays, etc but not fully articulate in PHP. I think your code snippet is on the right track but the Woo theme I am using has a lot of separate PHP files. Not sure which one would be the one to look at to insert your code.

    I think you need to start your search in your theme’s index.php file. Specifically, you’re looking for the start of the Loop.

    Thread Starter Garrett Cobarr

    (@garrett-cobarr)

    I shall seek it and return…

    Thread Starter Garrett Cobarr

    (@garrett-cobarr)

    Found it, several mentions of Loop, so pasted all of it.

    First time using pastebin, hope this works…

    http://wordpress.pastebin.com/VZHGcz6X

    I think it’s this snippet:

    <div class="entry">
                        	<?php if ($is_tumblog) { woo_tumblog_content_before(); } ?>
    	                    <?php if ( $woo_options['woo_post_content'] == "content" ) the_content(__('Continue Reading &rarr;', 'woothemes')); else the_excerpt(); ?>
                            <?php if ($is_tumblog) { woo_tumblog_content_after(); } ?>
                        </div>

    The code kindly provides an existing auto-incrementing counter a little further up that you could re-use:

    <?php if (have_posts()) : $count = 0; ?>
                <?php while (have_posts()) : the_post(); $count++; ?>

    So, if I’m right:

    <div class="entry">
                        	<?php if ($is_tumblog) { woo_tumblog_content_before(); } ?>
    	                    <?php if ( $woo_options['woo_post_content'] == "content" || $count == 1 ) the_content(__('Continue Reading &rarr;', 'woothemes')); else the_excerpt(); ?>
                            <?php if ($is_tumblog) { woo_tumblog_content_after(); } ?>
                        </div>

    should do the trick. The first post in that Loop will show all of the content up to the <!--more--> tag whilst the remainder will use the auto-excerpt.

    Thread Starter Garrett Cobarr

    (@garrett-cobarr)

    Thanks. I shall go in and see if I can manage not to blow it up.

    Thread Starter Garrett Cobarr

    (@garrett-cobarr)

    esmi Fantastic!

    It worked perfectly, see the result… WholeThinking

    Thanks again. –Garrett

    Thread Starter Garrett Cobarr

    (@garrett-cobarr)

    I just wanted to add something at the end here for posterity…

    The beauty of esmi’s solution is extended by using the <!–more–> at the end of your paragraph</p>, in your post, you will be able to control the exact length of your extended excerpt.

    Once the post ceases to be the most recent post and is no longer the_content() and returns control to the_excerpt(), the <!–more–> is ignored. You do not need to go back and remove it.

    It is a beautiful thing, thanks again esmi.

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘Expanded Front Page Summary/Excerpt/Teaser’ is closed to new replies.