Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.
<div class="group-training">

    <?php while ( $page_loop->have_posts() ) : $page_loop->the_post(); ?>
        <div class="entry">
            <h1><?php the_title(); ?></h1>                        
        </div>
    <?php endwhile; ?>

    <?php
        $page_args = array( 'page_id' => 86 );
        $page_loop = new WP_Query ( $page_args );
    ?>
    <div class="lordag">
        <?php while ( $page_loop->have_posts() ) : $page_loop->the_post(); ?>
            <div class="entry">
                <h1><?php the_title(); ?></h1>                        
            </div>
        <?php endwhile; ?>
    </div>

    <?php
        $page_args = array ( 'page_id' => 88 );
        $page_loop = new WP_Query ( $page_args );
    ?>

    <div class="sondag">
        <?php while ( $page_loop->have_posts() ) : $page_loop->the_post(); ?>
            <div class="entry">
                <h1><?php the_title(); ?></h1>                        
            </div>
        <?php endwhile; ?>
    </div>

</div>
share|improve this question
1  
Your code gets hidden. Please, fix your Markdown syntax. –  Geert Mar 28 '12 at 9:54
1  
Care to explain a bit? what you need? what have you tried? what does the code you posted have to do with the title? –  Bainternet Mar 28 '12 at 10:56
    
Thank for your answer, i want use if else to check page id, i begin wordpress and php –  user14638 Mar 28 '12 at 12:03
add comment

1 Answer

I use this maybe helpfull

<?php
   $title = get_the_title($post); 
   $parent_title = get_the_title($post->post_parent);

   echo $title;
   echo $parent_title;
  ?>


<?php
  global $post; //wordpress post global object
  if($post->post_type == 'page'){
    $content .= '<br /> This item is a page and the ID is: '.$post->ID;
  } elseif($post->post_type == 'post') {
    $content .= '<br /> This item is a post and the ID is: '.$post->ID;
  }
  echo $content;

?>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.