Created
September 13, 2015 10:44
-
-
Save tanjilahmed7/583fec5a9e1e2369039e to your computer and use it in GitHub Desktop.
Structure of the Loop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $args = array( | |
| // Arguments for your query. | |
| ); | |
| // Custom query. | |
| $query = new WP_Query( $args ); | |
| // Check that we have query results. | |
| if ( $query->have_posts() ) { | |
| // Start looping over the query results. | |
| while ( $query->have_posts() ) { | |
| $query->the_post(); | |
| ?> | |
| <article id="post-<?php the_ID(); ?>" <?php post_class( 'left' ); ?>> | |
| <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"> | |
| <?php post_thumbnail( 'thumbnail' );?> | |
| </a> | |
| <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"> | |
| <?php the_title(); ?> | |
| </a> | |
| <?php the_excerpt(); ?> | |
| </article> | |
| <?php | |
| } | |
| } | |
| // Restore original post data. | |
| wp_reset_postdata(); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment