1if ( ! defined('ABSPATH') ) {
2 /** Set up WordPress environment */
3 require_once( dirname( __FILE__ ) . '/wp-load.php' );
4}
5
6global $wpdb;
7$results = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}options WHERE option_id = 1", OBJECT );
1<?php
2// The Query
3$the_query = new WP_Query( $args );
4
5// The Loop
6if ( $the_query->have_posts() ) {
7 echo '<ul>';
8 while ( $the_query->have_posts() ) {
9 $the_query->the_post();
10 echo '<li>' . get_the_title() . '</li>';
11 }
12 echo '</ul>';
13} else {
14 // no posts found
15}
16/* Restore original Post Data */
17wp_reset_postdata();
1<?php
2// the query
3$the_query = new WP_Query( $args ); ?>
4
5<?php if ( $the_query->have_posts() ) : ?>
6
7 <!-- pagination here -->
8
9 <!-- the loop -->
10 <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
11 <h2><?php the_title(); ?></h2>
12 <?php endwhile; ?>
13 <!-- end of the loop -->
14
15 <!-- pagination here -->
16
17 <?php wp_reset_postdata(); ?>
18
19<?php else : ?>
20 <p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
21<?php endif; ?>
22