Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Talk:Function Reference/the content

This reference was in the article:

See also

http://wordpress.org/support/3/4236

And I clicked on it and if there was anything applicable there, it is long gone. How long do the posts stay on the forum? Anyway, it's here if someone knows of a reason to put it back. Lorelle 04:17, 24 Feb 2005 (GMT)


Text reads "(V2.0: Currently the 'more_file' parameter doesn't work)." That's like plausible deniability /after/ someone has tripped, fallen, broken their wrist. What's the skinny on this? --bentrem 05:25, 27 December 2007 (UTC)


Kaf made this beautiful example in the forums. I'd love to see it here as an example, since it is advanced enough and does what a lot of people want.:

<?php the_content("Continue reading $post->post_title"); ?>

Lorelle 13:02, 24 Feb 2005 (GMT)

Your wish is... Went with MDA's version instead since it provides an opportunity to show multiple tags interacting. A sort of "hey, look at how versatile these tags can be!"
-Kaf 19:34, 24 Feb 2005 (GMT)

So which version is which? Is MDA's version "going" to be here, or is this something else. All these versions....so many versions, so little time...that's not how it goes..but close. Lorelle 02:45, 25 Feb 2005 (GMT)

Hey, the example is there!
By "MDA's version" I meant that, in the thread you refer to, MDAWaffe suggested using:
<?php the_content("Continue reading " . the_title('', '', false)); ?>
There's no functional difference between these, but the latter just deals with another template tag while mine causes PHP newcomers to face WP's internals head on. That's something I'd only do when it's absolutely necessary.
-Kaf 04:02, 25 Feb 2005 (GMT)

Okay, so I need some sleep. I was in an auto repair shop spending WAY too much money today, sitting and waiting for the repairs to complete form 8:30AM until 4PM...but I got a LOT of edits and suggestions and work done on the Codex...on paper...so I'm really tired out and just missed the addition to the post.

And I thought the example with the period didn't work but the one with the > did? Either way, loverly. Lorelle 05:01, 25 Feb 2005 (GMT)

I just caught this! In the first example, the text is in single quotes. In the second example, the "Continue Reading" is in double quotes. Does it matter? Lorelle 14:01, 6 Apr 2005 (UTC)


More - Link Address

I've run into something odd and if it is true, I think it might be a good "preventative measure" to include the information in the codex.

When using the_content('Continue Reading...') what kind of link is generated? Relative or absolute? So far, what I'm seeing it absolute reference. I don't have permalinks set up on my test site yet, but the link generated is to http://example.com/wordpress/?p=395#more-395 instead of something like wordpress/?p=395#more-395.

Would permalinks change the reference from absolute to relative with this tag? Or is this "just how it is"? I caught this while trying to use CSS to identify http external links from internal non-http prefixed links. Without the relative link, I'm struggling to get rid of my little external arrow from Continue Reading.

Lorelle 20:41, 10 Mar 2005 (UTC)

Returning the_content for use in PHP?

Does anyone know if it's possible to return the post content as a string, for use in PHP? wp_title() can do it; can the_content()? Thanks, Samwilson 06:00, 27 Sep 2006 (GMT)

  • You want get_the_content - most of the WordPress template tags have a get_ alternative that returns the text instead of echoing it. --Westi 09:16, 27 Sep 2006 (GMT)
  • "most of the WordPress template tags have a get_ alternative that returns the text instead of echoing it." - This should be noted and documented for EACH function, to help all developing with the functions. If the get_ function is related to the function it should be related at the bottom, have it's own page or be included in documentation. I have added this to this function's documentation per common logic. --Sc0ttkclark 18:04, 11 September 2008 (UTC)