Created
October 10, 2013 04:39
-
-
Save guzuri/6913130 to your computer and use it in GitHub Desktop.
get_postsテンプレート
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 if(get_field('movie_flag') == 'search'): ?> | |
<?php | |
$search = get_field('movie_tag'); | |
$max_result = get_field('movie_count'); | |
$arg = | |
array( | |
'post_type' => 'd_movie', | |
'posts_per_page' => $max_result , | |
'tax_query' => array( | |
array( | |
'taxonomy' => 'd_movie_tags', | |
'field' => 'slug', | |
'terms' => $search | |
) | |
) | |
); | |
$posts = get_posts( $arg ); | |
if( $posts ): ?> | |
<ul> | |
<?php foreach ( $posts as $post ) : | |
setup_postdata( $post );?> | |
<li> | |
</li> | |
<?php wp_reset_postdata(); ?> | |
<?php endforeach; ?> | |
</ul> | |
<?php endif; ?> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment