Text reads "HTML tags and graphics are stripped from the excerpt's content." ... and nobody has complained loud enough? Ok, images can be considered merely aesthetic, but /what/ do you gain by stripping URLs?! This seems merely perverse ... like special treatment for "cockney". --bentrem 05:30, 27 December 2007 (UTC)
I'd really like to see a use of the Excerpt used within the loop so people will know where it goes. Also expanding info on whether or not it will show the actual "excerpt" as written in the "excerpt" field or only the first 120 words of the test. Add to that any CSS classes that can be set in the excerpt so it can be modified on the category and index.php pages. Would this info or links to this kind of info be appropriate to add here?
:)
-Kaf 22:00, 23 Jan 2005 (GMT)I've been editing these pages by the gross (and they've needed it), learning about the program as I go. I certainly can't write about things I don't know anything about, but when I do learn it, it'll show up here. I'm doing my part, it just doesn't have my name splashed all over it.
As for the expansion...enough so we understand where to put it. To say "put it inside the loop" isn't very specific. Where specifically do we put it? The rule of thumb for technical pages like these is short, concise, and redundant. Presume total beginner and give them enough to put it in context as simple and thorough as possible - even to redundancy. Does that help?
Couple of more things I'd like to see on this page.
To answer a few points above, well, the template tag only displays the text excerpt. That is all it does - is to retrieve whatever text is stored as "the excerpt" which is the first fewwords of the post, cleanse it using text-filters and display it wherever the tag is used. No css, or any other stuff. The size of the excerpt if a seperate excerpt is not typed in by the user is the first "N" characters, where "N" is a setting, that is hardcoded. I do not remember it off the bat now.
Keep the notes coming, they will make for better docs - I really appreciate your inputs, and we'll see if we can answer a few of these and other questions as we go along.
Excellent explanation. Let's make sure the most critical and helpful of this information (stripping tags vs not stripping) is in the article). With information in the Excerpt that isn't stripped, then "anything" can be done with it. Wonderful.
>>>Both content and excerpt in the database are limited to 64K (yeah, about 10,000 words);<<<<
I think this is highly critical information but I'm seeing it here for the first time. Where is this mentioned? It should be in the section that gives information on creating posts. Did I miss it? I'm notorious for excessive babble. So this is a MySQL limit...hmmmm.
Thank you so much. This will help with the editing.
Lorelle 15:51, 5 Feb 2005 (GMT)
I see that my verbosity will not be limited now. Thanks.
Related but different, I know this isn't a place for tech support, but I followed the specific instructions in the article about replacing the the_content
with the_excerpt
in 1.5 and the excerpts are the only things that show up - even in the posts. I tried the if/then example and got a line error on that line. AH, took another look and the || is a signal to give a choice. This has to go. I did what everyone with less than two brain cells to rub together would do and simply copied and pasted the info directly into the code. We need to keep our examples clean enough to do that. Better to show more examples than expect us twits to know enough to recognize that the code needs editing.
Anyway, with the disappearance of the "if single post", we need to be more specific on where to put the excerpt tag within the loop related to 1.5, if there is a difference. I assume it goes in the Loop, but the Loop has changed. The first example of an if/then statement would be showing an "if excerpt - excerpt. if no excerpt, then excerpt from content or content." Clearly, better written than that....;-)
Lorelle 00:59, 6 Feb 2005 (GMT)
<?php the_content(); ?>
||
(meaning OR) in Example 2 means exactly what the description says. Are you looking at an Archive OR a Category? If yes: display excerpt. If no: display content.The ||
isn't very clear. I know it looks that way to you. I messed with it for quite a while before I looked at the code I copied and pasted and thought, hmmm, I don't remember seeing pipes in the code anywhere else. Does PHP use pipes? Remember, I'm new enough to this to be like the new users who will encounter these same bugaboos. I'd really rather see two examples than the use of the pipes. Think of all the forum questions for help this will generate if they do the same thing I did.
To FINALLY get the excerpts to work, I searched on google and found the reference from the old wiki which included the specific loop for excerpt or post excerpt:
<?php if ($single) { the_content(); } else { the_excerpt(); } ?>
Familiar? That worked like a charm. the $single
made all the difference. The other code (minus the pipes) brought only excerpts on the posts. If the $single reference shouldn't work in 1.5 or should, the codex needs to reflect that. If not, it needs to have the simpliest of this form as the leading example to avoid the problem I had.
Thanks for helping me understand this. I don't know enough about the code to verify anything except by trial and error, but I can edit and fix layout "real good". If I'm having trouble with something, you can bet there are a hundred people just like me. I appreciate the help in making this understandable to everyone.
Lorelle 05:58, 7 Feb 2005 (GMT)
if ( is_single() ) {...}
is the preferred method for doing what you describe above. See Ryan's Description (linked to from the bottom of Theme Development). I assume, then, by "on the posts" you meant "when viewing the page for a single post". I cannot speculate why copying and pasting did not work for you; as I said it worked for me. It is possible that the pipes were translated by your computer into vertical bars (not the same character). I seem to recall hearing something about that possibility at one point. Try copying and pasting again, but deleting the pipes and retyping them.:)
And now for something completely different. I think we should be using 1.5 notation over 1.2 on the Codex. Thus, $cat and $m should be replaced with is_category() and is_archive() in the examples section. Thoughts? --MDAWaffe 08:49, 4 Feb 2005 (GMT)
Okay, I've asked and nothing is happening on this. If I is frustrated as a user, expect others to be just as stressed. The examples herein don't list the most simple of layouts, something to the effect of "list the excerpt otherwise, and especially if in a single post, list the content". Building from there to have something like "if this is the main page, or a category, or an archive, then post the excerpt, otherwise, if a single post, post the post". Building slowly on the examples.
And then there is the shorthand version of this. I have run across things like:
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
Which doesn't look like any of the examples in the article. What is this, anyway? The Loop abbreviated or something else?
We need to clean this up, show good progressive examples, show how HTML can be put inbetween each of the php codes, and show how they can be shorthanded, and then get to the advanced stuff where the category changes the look. Someone please help me on this. I weak, ignorant little spirit, desperately seeking assistance to help others help themselves.
Lorelle 23:31, 4 Mar 2005 (UTC)
I'm still seeing <br /> tags in the source of my excerpts - is this correct behaviour? --Junap 18:02, 13 Nov 2006 (GMT)
look at this extension: http://guff.szub.net/2005/02/26/the_excerpt-reloaded/. Ramiy 22:07, 30 April 2008 (UTC)