WordPress.org

Forums

[resolved] Query for page title / text (4 posts)

  1. c-bass
    Member
    Posted 6 years ago #

    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?

  2. c-bass
    Member
    Posted 6 years ago #

    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; ?>
  3. MichaelH
    Member
    Posted 6 years ago #

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

  4. c-bass
    Member
    Posted 6 years ago #

    thanks, solved

Topic Closed

This topic has been closed to new replies.

About this Topic