本文整理汇总了PHP中WP_Query::ID方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Query::ID方法的具体用法?PHP WP_Query::ID怎么用?PHP WP_Query::ID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WP_Query
的用法示例。
在下文中一共展示了WP_Query::ID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
<?php
get_header();
?>
<!-- Header Ends Here -->
<?php
$args = array('post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => '1', 'order' => 'DESC', 'orderby' => 'date', 'category__in' => '5');
$posts_query = new WP_Query($args);
?>
<!-- Content Begins Here -->
<!-- Main Content Section Begins Here -->
<div class="container">
<div class="row">
<div class="col-xs-12 margin-bottom-lg">
<?php
add_flexslider($posts_query->ID());
?>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-8">
<?php
if ($posts_query->have_posts()) {
?>
<!-- the loop -->
<?php
while ($posts_query->have_posts()) {
$posts_query->the_post();
?>
示例2: array
$abt_args = array('pagename' => 'about');
$p = new WP_Query($abt_args);
?>
<!-- Main Content Section Begins Here -->
<div class="container">
<div class="row">
<div class="col-xs-12">
<div class="row">
<?php
if ($p->have_posts()) {
while ($p->have_posts()) {
$p->the_post();
?>
<div class="col-xs-12 center-block text-center">
<?php
$thumb = get_attached_media('image', $p->ID());
$url = $thumb['0'];
?>
<div class="row">
<div class="col-xs-12 bgCover" style="background:url(<?php
echo $url;
?>
)">
<div class="margin-bottom-xl"></div>
<div class="row">
<div class="col-xs-12 well">
<div class="row">
<div class="col-xs-12">
<div class="row">
<div class="col-xs-12 col-sm-8 vcenter">
<div class="row">