本文整理汇总了PHP中WP_Query::query_posts方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Query::query_posts方法的具体用法?PHP WP_Query::query_posts怎么用?PHP WP_Query::query_posts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WP_Query
的用法示例。
在下文中一共展示了WP_Query::query_posts方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
<p>Lee Brothers Paint provides the finest paints on the market, offering a broad spectrum of prices for anyone’s budget - including taking the lead in VOC free paints and VOC ‘friendly’ paints. We do not carry any paint we haven’t tried and/or tested to make sure it does exactly what we say it will. We stand behind our products 100%.</p>
</div>
</div>
<div class="row">
<div class="white-box-header">
<h4 class="bold section-header medium-gray-font">COUPONS</h4>
</div>
<div class="gray-header-section clearfix">
<?php
$args = array('post_type' => 'coupon', 'posts_per_page' => 2);
$query = new WP_Query($args);
?>
<?php
$query->query_posts('showposts=2');
?>
<?php
if ($query->have_posts()) {
while ($query->have_posts()) {
$query->the_post();
?>
<div class="col-xs-12 col-sm-6 white-box">
<div class="coupon text-center">
<div class="inner-coupon-block-top-bottom">
<div class="inner-coupon-block-left-right">
<img class="coupon-logo full-width-img bottom-spacing" src="<?php
bloginfo('template_directory');
?>
/img/logo.jpg" alt="Lee Brothers Logo">