WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Retrieving all posts titles with its custom fields values (6 posts)

  1. M Szatkowski
    Member
    Posted 3 years ago #

    Retrieving all posts titles with its custom fields values one one page...

    Any ideas?

  2. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

  3. M Szatkowski
    Member
    Posted 3 years ago #

    thanks but these are according to specific custom field or it's value.
    I found no specification how to do it FOR ALL posts' fields and values

  4. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    for ALL posts, for instancs, use 'posts_per_page=-1' in query_posts; or 'numberposts=-1' in get_posts.

    read the docu.

  5. MichaelH
    Member
    Posted 3 years ago #

    <?php
    $args=array(
      'post_type' => 'post',
      'post_status' => 'publish',
      'posts_per_page' => -1,
      '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_meta();
      endwhile;
    }
    wp_reset_query();  // Restore global post data stomped by the_post().
    ?>
  6. M Szatkowski
    Member
    Posted 3 years ago #

    great! thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic