Created
April 24, 2013 16:50
-
-
Save landru247/5453644 to your computer and use it in GitHub Desktop.
WordPress: PHP ForEach Loop
This file contains 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( 'post_type' => '{cpt-name}', 'numberposts' => 4, '{taxomony-name}' => '{checked-item}' ); | |
$lastposts = get_posts( $args ); | |
foreach($lastposts as $post) : setup_postdata($post); | |
?> | |
<?php endforeach; ?> |
This file contains 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( 'post_type' => '{cpt-name}', 'numberposts' => 4, '{taxomony-name}' => '{checked-item}' ); | |
$lastposts = get_posts( $args ); | |
foreach($lastposts as $post) : setup_postdata($post); | |
?> | |
<?php endforeach; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment