WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Query for page title / text

[Resolved] Query for page title / text

  • Hey,

    i would like to use wp as a cms for a client. thus i would like to show with other posts some information of pages on the frontpage.

    for that i will need the query for page titles and maybe the content as well so the client would not have to go into the code.

    for posts it is like:

    <?php $my_query = new WP_Query('cat=17,18,19&showposts=5');
    							  while ($my_query->have_posts()) : $my_query->the_post();
    							  $do_not_duplicate = $post->ID;?>

    but how to use queries for PAGES?

Viewing 3 replies - 1 through 3 (of 3 total)
  • found a way. make sure to change the name of the page at “pagename=about”

    <?php $contact_drop = new WP_Query('pagename=about'); while ($contact_drop->have_posts()) : $contact_drop->the_post(); $do_not_duplicate = $post->ID; ?>						
    
    								<h2><?php the_title(); ?></h2>
    
    									<?php the_excerpt(); ?>
    									<p><a href="<?php the_permalink(); ?>" title="Learn more about <?php the_title(); ?>" class="more-link">Learn more</a></p>
    
    							  <?php endwhile; ?>

    new WP_Query('post_type=page') for something more generic

    thanks, solved

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Query for page title / text’ is closed to new replies.
Skip to toolbar