M
M
Max2018-02-08 15:56:38
WordPress
Max, 2018-02-08 15:56:38

Displaying all WordPress posts?

I need that in the form of sending a person could select the name of the record, that is, in the form there is a select, and in it all the records of the site, the person selects the desired record.
Please help)
Probably the question is easy, but I can not understand how to do it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex-1917, 2018-02-08
@alex-1917

Are you so afraid of Yandex and Google, this sweet couple, or just a beer belly does not allow you to do anything extra???!!

<?php
// запрос
$wpb_all_query = new WP_Query(array('post_type'=>'post', 'post_status'=>'publish', 'posts_per_page'=>-1)); ?>

<?php if ( $wpb_all_query->have_posts() ) : ?>

<ul>

  <!-- the loop -->
  <?php while ( $wpb_all_query->have_posts() ) : $wpb_all_query->the_post(); ?>
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
  <?php endwhile; ?>
  <!-- end of the loop -->

</ul>

  <?php wp_reset_postdata(); ?>

<?php else : ?>
  <p><?php _e( 'Извините, нет записей, соответствуюших Вашему запросу.' ); ?></p>
<?php endif; ?>

If you are reading this line, it means that you managed to get to the bottom, congratulations, here is an important note: change ul to select, show your civil position!!!...)))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question