[buddypress-trac] [BuddyPress Trac] #6153: is_page AND is_single both set on page footer (reproducable

buddypress-trac noreply at wordpress.org
Wed Jan 21 23:41:37 UTC 2015


#6153: is_page AND is_single both set on page footer (reproducable
--------------------------+-----------------------------
 Reporter:  juggledad     |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Core          |    Version:  2.1
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 Using TwentyFifteen, at the end of page.php both is_page() and is_single
 are true. To repeoduce this do the following
 1) clean install of WP
 2) create a page called 'Members' - set 'Dicussion' to allow comments
 3) edit twentyfifteen's page.php and replace it with the following (it
 just has a bunch of echo's added)

 {{{
 <?php
 /**
  * The template for displaying pages
  *
  * This is the template that displays all pages by default.
  * Please note that this is the WordPress construct of pages and that
  * other "pages" on your WordPress site will use a different template.
  *
  * @package WordPress
  * @subpackage Twenty_Fifteen
  * @since Twenty Fifteen 1.0
  */

 get_header(); ?>
 <?php echo '1 is_single()='.is_single().'<br>'; ?>
 <?php echo '1 is_page()='.is_page().'<br>'; ?>

         <div id="primary" class="content-area">
                 <main id="main" class="site-main" role="main">

                 <?php
                 // Start the loop.
                 while ( have_posts() ) : the_post();
  echo '2 is_single()='.is_single().'<br>';
  echo '2 is_page()='.is_page().'<br>';

                         // Include the page content template.
                         get_template_part( 'content', 'page' );
  echo '3 is_single()='.is_single().'<br>';
  echo '3 is_page()='.is_page().'<br>';

                         // If comments are open or we have at least one
 comment, load up the comment template.
                         if ( comments_open() || get_comments_number() ) :
                                 comments_template();
                         endif;
  echo '4 is_single()='.is_single().'<br>';
  echo '4 is_page()='.is_page().'<br>';
                 // End the loop.
                 endwhile;
                 ?>

                 </main><!-- .site-main -->
         </div><!-- .content-area -->
 <?php echo '5 is_single()='.is_single().'<br>'; ?>
 <?php echo '5 is_page()='.is_page().'<br>'; ?>

 <?php get_footer(); ?>

 }}}
 4) add the page to a menu and set the menu as the primary menu
 5) view the page

 in each set of echo's you will see
 n is_single()=
 n is_page()=1

 6) install BuddyPress (this is a problem in 2.1 and 2.2 Beta 2)
 7) in dashboard->settings->buddypress->pages set the Members to the
 Members page
 8) go view the page

 at this point you will see that the first set of echo's - just after the
 get_header() - will be
 1 is_single()=
 1 is_page()=1

 the second set of echo's - right after the 'while ( have_posts() ) :
 the_post();' will be
 2 is_single()=
 2 is_page()=1

 the third set of echo's - right after the 'get_template_part( 'content',
 'page' );' will be
 3 is_single()=
 3 is_page()=

 the forth set of echo's - right before the '// End the loop.' will be
 4 is_single()=
 4 is_page()=

 and the fifth set of echo - right before the 'get_footer();' - will be
 5 is_single()=1
 5 is_page()=1

 something is clearly not proper.

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6153>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list