Make WordPress Core

Opened 14 years ago

Closed 13 years ago

#6312 closed defect (bug) (fixed)

parameter 'stripteaser' of get_the_content does not work as expected

Reported by: makibo Owned by:
Milestone: 2.8 Priority: normal
Severity: normal Version: 2.3.3
Component: Template Keywords: has-patch, stripteaser, the_content, more, early
Focuses: Cc:


Hi there,

let's imagine this case:

On a wordpress site some posts got the more-Tag, some don't.
The content before the more-Tag is called "teaser", the rest is the content.
I want to display the teaser at one place of the site (e.g. div) and the rest of the entry at another place (other div)

Now the excpected behaviour of the_content with stripteaser set to true would be, that it strips off the teaser (if any) and outputs the rest of the entry. If an entry hasn't got a teaser it should display the entry.

instead it currently strips of the complete entry, if no teaser (e.g. more-Tag) was found.

I recommend the following changes to get_the_content (file: post_template.php):

line 88 - add (init variable)

$hasTeaser = false;

line 110 - add (if more tag was found)

$hasTeaser = true;

line ~121 - change

if ( ($more) && ($stripteaser) )


if ( ($more) && ($stripteaser) && ($hasTeaser) )


Attachments (2)

6312.diff (1.1 KB) - added by makibo 14 years ago.
patched post-template.php
6312.2.diff (1.1 KB) - added by simonwheatley 13 years ago.
Amended patch to work against trunk (as of right now)

Download all attachments as: .zip

Change History (8)

#1 @lloydbudd
14 years ago

  • Milestone changed from 2.3.4 to 2.7
  • Priority changed from high to normal

makibo, please don't change the milestone. Leave that for core contributors. Could you attach a patch vs trunk?

#2 @makibo
14 years ago

Hello again,

i hope i did the .diff right - unfortunately it won't render as html..

i'll keep the thing w/ the milestone in my mind
just didn't knew it as this is my first ticket

14 years ago

patched post-template.php

#3 @makibo
14 years ago

ok - i rebuild it using a tut from peter westwood and now it renders correct;
hope you'll find this useful


#4 @ryan
13 years ago

  • Keywords early added
  • Milestone changed from 2.7 to 2.8

13 years ago

Amended patch to work against trunk (as of right now)

#5 @simonwheatley
13 years ago

  • Keywords has-patch added

Verified unexpected behaviour still exists in trunk. Applied patch to trunk, verified expected behaviour. Amended patch to current trunk.

#6 @ryan
13 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [10954]) Fix teaser stripping when no teaser. Props makibo, simonwheatley. fixes #6312

Note: See TracTickets for help on using tickets.