• What is the function that lists posts. In my php page, I am simply trying to get posts from a certain category. I see permalink() and titles(), but I want the posts.

    i am trying to populate a page ( which I am doing with a hook or plugin) and I am editing someones site with posts already done. Not an option to it another way. I am so close, I can’t believe something so basic is beyond my reach. I would think this would be a common funtion and request. Thanks so much for any help.

    I would like the arguments to be limit to the last 3 post in a category.

Viewing 1 replies (of 1 total)
  • Put this in a Page Template:

    <?php
    //get three posts for category 27
        $args=array(
          'cat' => 27;
          'post_type' => 'post',
          'post_status' => 'publish',
          'posts_per_page' => 3,
          'caller_get_posts'=> 1
          );
        $my_query = null;
        $my_query = new WP_Query($args);
        if( $my_query->have_posts() ) {
          echo 'List of Posts';
          while ($my_query->have_posts()) : $my_query->the_post(); ?>
          <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
           <?php
            the_content();
          endwhile;
        }
    wp_reset_query();  // Restore global post data stomped by the_post().
    ?>

Viewing 1 replies (of 1 total)
  • The topic ‘function to call posts to put in a page’ is closed to new replies.