[wp-trac] [WordPress Trac] #21894: <!--more--> tag does nothing in secondary loops when is_single because of $more global

WordPress Trac wp-trac at lists.automattic.com
Fri Sep 14 21:50:59 UTC 2012


#21894: <!--more--> tag does nothing in secondary loops when is_single because of
$more global
--------------------------+------------------------------
 Reporter:  jeremyclarke  |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Formatting    |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:                |
--------------------------+------------------------------

Comment (by jeremyclarke):

 While preparing a plugin-based temporary solution to this I realized that
 I attacked it from the wrong angle. I somehow didn't think of the fact
 that {{{setup_postdata()}}} gets run for each post, and $more is
 initialized for each spin of the loop.

 It seems clear that the actual right place to put the new logic is in
 {{{setup_postdata()}}}:

 {{{
 if ( ( is_single() || is_page() ) && ( $id == get_queried_object_id() ) )
         $more = 1;
 if ( is_feed())
         $more = 1;
 }}}

 Sorry for adding noise. I think changing setup_postdata() si an even more
 obvious win than the change in get_the_content(), though both will solve
 my problem.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21894#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list