Php 使用特定模板循环浏览页面
您好,有没有一种方法可以循环浏览使用特定模板的wordpress页面?尝试以下方法:Php 使用特定模板循环浏览页面,php,wordpress,templates,loops,Php,Wordpress,Templates,Loops,您好,有没有一种方法可以循环浏览使用特定模板的wordpress页面?尝试以下方法: $template = 'NAME'; $query = new WP_Query( array( 'meta_key' => '_wp_page_template', 'meta_value' => $template.'.php' ) ); while( $query->have_posts() ) : $query->the_post(); ... endwhile;
$template = 'NAME';
$query = new WP_Query( array( 'meta_key' => '_wp_page_template', 'meta_value' => $template.'.php' ) );
while( $query->have_posts() ) : $query->the_post();
...
endwhile;
请尝试以下操作:
$template = 'NAME';
$query = new WP_Query( array( 'meta_key' => '_wp_page_template', 'meta_value' => $template.'.php' ) );
while( $query->have_posts() ) : $query->the_post();
...
endwhile;
有没有任何源代码可以告诉我们你的处境?如果没有更具体的细节,很难确定你的问题是什么。有没有任何源代码可以告诉我们你遇到了什么困难?如果没有更具体的细节,很难确定你的问题是什么。