• Hello, I’m a newbie in worpdress, and I want to know how to display pages content including title, permalinks, excerpt by ID because I have a lot of pages but I only want 3 specific pages content to display on my home page.. plus, I want to make something different, I want to use different for every content displayed.. how to use the if statement inside the loop? like

    if page id = 12 then <h2 style=”background-image:url(…..)”><?php the_title();?></h2>

    if page id = 14 then <h2 style=”background-image:url(…..)”><?php the_title();?></h2>

    else <h2 style=”background-image:url(…..)”><?php the_title();?></h2>

Viewing 1 replies (of 1 total)
  • Thread Starter markyeoj

    (@markyeoj)

    This is my code,, but not working…

    <?php $args = array(
    						  'post_type' => 'page',
    						  'post__in' => array(3,5,7)
    						  );
    						query_posts($args);
    						while (have_posts()) : the_post();
    						$do_not_duplicate = $post->ID; ?>
    					<div class ="date_author group">
    						<h3 class="date"><?php the_time('M j, y');?></h3>
    						</div>
    						<h3 class="title"><a STYLE="text-decoration:none" href = "<?php the_permalink();?>"><?php 			the_title();?></a></h3>
    
    						<?php the_excerpt();?>
    
    						<?php endwhile; ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Query Page by ID’ is closed to new replies.