本文整理汇总了PHP中wp_query类的典型用法代码示例。如果您正苦于以下问题:PHP wp_query类的具体用法?PHP wp_query怎么用?PHP wp_query使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了wp_query类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: lasso_editor_galleries_exist
/**
* Check to see if any Lasso galleries exist
*
* @since 1.0
*/
function lasso_editor_galleries_exist()
{
$q = new wp_query(array('post_type' => 'ai_galleries', 'post_status' => 'publish'));
if ($q->have_posts()) {
return true;
} else {
return false;
}
}
开发者ID:skmezanul,项目名称:lasso,代码行数:14,代码来源:helpers.php
示例2: home_banners_func
function home_banners_func($atts, $content = null)
{
// New function parameter $content is added!
extract(shortcode_atts(array('width' => '1/2', 'el_position' => '', 'section_height' => '', 'loop' => '', 'slideshow' => '', 'time' => '', 'transition_time' => ''), $atts));
$output = '';
global $post;
// get recent posts
$args = array('post_type' => 'banner', 'posts_per_page' => -1, 'orderby' => 'menu_order', 'order' => 'ASC', 'caller_get_posts' => 1);
$posts = new wp_query($args);
// if posts exist
if ($posts->have_posts()) {
$output .= '<section class="flexslider std-slider" data-height="' . $section_height . '" data-loop="' . $loop . '" data-smooth="false" data-slideshow="' . $slideshow . '" data-speed="' . $time . '" data-animspeed="' . $transition_time . '" data-controls="true" data-dircontrols="true">';
$output .= '<ul class="slides">';
// loop through and display them
while ($posts->have_posts()) {
$posts->the_post();
if (rwmb_meta('_wp_banner_image', $post->ID)) {
$images = rwmb_meta('_wp_banner_image', 'type=plupload_image', $post->ID);
if (count($images) > 0) {
foreach ($images as $image) {
$image_url = wp_get_attachment_image_src($image['ID'], 'full');
$output .= '<li data-bg="' . $image_url[0] . '">';
}
}
}
$output .= '<div class="container">';
$output .= '<div class="inner">';
$output .= '<div class="row">';
$output .= '<div class="text-center animated" data-fx="fadeIn">';
if (rwmb_meta('_wp_title', get_the_ID())) {
$output .= '<h2>' . rwmb_meta('_wp_title', get_the_ID()) . '</h2>';
}
if (rwmb_meta('_wp_sub_title', get_the_ID())) {
$output .= '<p>' . rwmb_meta('_wp_sub_title', get_the_ID()) . '</p>';
}
if (rwmb_meta('_wp_show_button_1', get_the_ID()) == 1) {
$output .= '<a href="' . rwmb_meta('_wp_button_1_url', get_the_ID()) . '" class="btn btn-primary btn-lg local">' . rwmb_meta('_wp_button_1_text', get_the_ID()) . '</a>';
}
if (rwmb_meta('_wp_show_button_2', get_the_ID()) == 1) {
$output .= '<a href="' . rwmb_meta('_wp_button_2_url', get_the_ID()) . '" class="btn btn-default btn-lg">' . rwmb_meta('_wp_button_2_text', get_the_ID()) . '</a>';
}
$output .= '</div>';
$output .= '<div class="col-md-6"></div>';
$output .= '</div>';
$output .= '</div>';
$output .= '</div>';
$output .= '</li>';
}
$output .= '</ul>';
$output .= '</section>';
}
wp_reset_query();
return $output;
}
开发者ID:Kafia,项目名称:Mark-WordPress-Theme-,代码行数:54,代码来源:home-banners.php
示例3: custom_query
function custom_query($atts)
{
extract(shortcode_atts(array('query_string' => ''), $atts));
$result = '';
global $post;
$query = new wp_query($query_string);
if ($query->have_posts()) {
while ($query->have_posts()) {
$query->the_post();
$meta = get_post_meta($post->ID, 'thumbnail', true);
$result .= "<div class='post-item'>\n\t\t\t\t\t\t\t<a href=" . get_permalink() . "><img width='100' height='100' src=" . $meta . " /></a>\n\t\t\t\t\t\t\t<h1><a href=" . get_permalink() . ">" . get_the_title() . "</a></h1>\n\t\t\t\t\t\t\t<p class='metadata'><span class='post'>Posted by:</span>" . get_the_author() . "<span class='in-cat'>In:</span>" . get_the_category_list(', ') . "<span class='on-date'>On:</span>" . get_comment_time() . "<a href=" . get_comments_link() . ">" . get_comments_number('1 comment', '2 comment', '% comment') . "</a></p>\n\t\t\t\t\t\t\t<p>" . get_the_content() . "</p>\n\t\t\t\t\t\t\t<p><a class='more-link floatright' href=" . get_permalink() . ">Read More</a></p>\n\t\t\t\t\t\t</div>";
}
}
return $result;
}
开发者ID:mynein,项目名称:myne,代码行数:15,代码来源:custom_query.php
示例4: mbdmaster_latest_posts
/**
* Show the most recent posts
*/
function mbdmaster_latest_posts()
{
global $post;
$orig_post = $post;
$args = array('posts_per_page' => 3, 'ignore_sticky_posts' => 1);
$my_query = new wp_query($args);
if ($my_query->have_posts()) {
while ($my_query->have_posts()) {
$my_query->the_post();
get_template_part('content', 'archive');
}
$post = $orig_post;
wp_reset_query();
}
}
开发者ID:markbaindesign,项目名称:mbd-wp-theme,代码行数:18,代码来源:latest-posts.php
示例5: recent_projects_func
function recent_projects_func($atts, $content = null)
{
// New function parameter $content is added!
extract(shortcode_atts(array('width' => '1/2', 'el_position' => '', 'number' => ''), $atts));
$output = '';
global $post;
// get recent posts
$args = array('post_type' => 'portfolio', 'posts_per_page' => $number, 'caller_get_posts' => 1);
$portfolio_items = new wp_query($args);
// if posts exist
if ($portfolio_items->have_posts()) {
$output .= '<div id="galleryContainer" class="clearfix">';
// loop through and display them
while ($portfolio_items->have_posts()) {
$portfolio_items->the_post();
// find and display categories of portfolio items
$categories = get_the_terms(get_the_ID(), 'portfolio-category');
if ($categories && !is_wp_error($categories)) {
$cat_list = array();
$cat_list_slug = array();
foreach ($categories as $category) {
$cat_list[] = $category->name;
$cat_list_slug[] = $category->slug;
}
$types = join(" ", $cat_list_slug);
$types_comma = join(", ", $cat_list);
}
if (has_post_thumbnail()) {
$output .= '<div class="galleryItem ' . $types . '">';
$output .= '<a href="' . get_the_permalink() . '" class="area-hover">';
$output .= '<div class="vertical-parent">';
$output .= '<div class="vertical-child">';
$output .= '<span class="cat-links">' . $types_comma . '</span>';
$output .= '<h4 class="entry-title">' . get_the_title() . '</h4>';
$output .= '</div>';
$output .= '</div>';
$output .= '</a>';
$output .= '<a href="' . get_the_permalink() . '">' . get_the_post_thumbnail(get_the_ID(), 'related') . '</a>';
$output .= '</div>';
}
}
$output .= '</div>';
}
wp_reset_query();
return $output;
}
开发者ID:Kafia,项目名称:Mark-WordPress-Theme-,代码行数:46,代码来源:recent-projects.php
示例6: ticker_function
function ticker_function($atts, $content)
{
extract(shortcode_atts(array('style' => 'left'), $atts));
?>
<div class="wd_sticker">
<?php
ob_start();
?>
<?php
$ticker = new wp_query(array('meta_key' => THEME_SLUG . 'showbreakingnews', 'ignore_sticky_posts' => 1, 'meta_value' => 1));
?>
<?php
if ($ticker->have_posts()) {
?>
<ul id="js-news" class="js-hidden">
<?php
while ($ticker->have_posts()) {
$ticker->the_post();
global $post;
?>
<li class="news-item"><?php
the_title();
?>
<a href="<?php
the_permalink();
?>
"><?php
_e('view more', 'wpdance');
?>
</a></li>
<?php
}
?>
</ul>
<?php
}
$result = ob_get_contents();
ob_end_clean();
wp_reset_postdata();
?>
</div>
<?php
return $result;
}
开发者ID:mynein,项目名称:myne,代码行数:45,代码来源:ticker.php
示例7: mbdmaster_related_posts
/**
* Show a set of related posts based on tags
*/
function mbdmaster_related_posts()
{
global $post;
$orig_post = $post;
$custom_taxterms = wp_get_object_terms($post->ID, 'post_tag', array('fields' => 'ids'));
$args = array('post_type' => array('award', 'book', 'interview', 'project', 'post', 'talk', 'film'), 'post__not_in' => array($post->ID), 'posts_per_page' => 3, 'ignore_sticky_posts' => 1, 'tax_query' => array(array('taxonomy' => 'post_tag', 'field' => 'id', 'terms' => $custom_taxterms)));
$my_query = new wp_query($args);
if ($my_query->have_posts()) {
while ($my_query->have_posts()) {
$my_query->the_post();
get_template_part('content', 'archive');
}
$post = $orig_post;
wp_reset_query();
} else {
echo 'Nothing found... Looks like this post is just unique :)';
}
}
开发者ID:markbaindesign,项目名称:mbd-wp-theme,代码行数:21,代码来源:related-posts.php
示例8: mbdmaster_related_custom_posts
/**
* Show a set of related posts based on a custom taxonomy
*/
function mbdmaster_related_custom_posts()
{
global $post;
$orig_post = $post;
$custom_taxterms = wp_get_object_terms($post->ID, 'tag', array('fields' => 'ids'));
$args = array('post_type' => 'work', 'post_status' => 'publish', 'posts_per_page' => 3, 'orderby' => 'rand', 'tax_query' => array(array('taxonomy' => 'tag', 'field' => 'id', 'terms' => $custom_taxterms)), 'post__not_in' => array($post->ID));
$my_query = new wp_query($args);
if ($my_query->have_posts()) {
while ($my_query->have_posts()) {
$my_query->the_post();
get_template_part('content', 'archive');
}
$post = $orig_post;
wp_reset_query();
} else {
_e('Sorry, but there is no related work at this time.', '_mbdmaster');
}
}
开发者ID:markbaindesign,项目名称:mbd-wp-theme,代码行数:21,代码来源:related-custom-posts.php
示例9: sidebars_remove
function sidebars_remove($sidebar_id, $default_id = null)
{
global $post;
$data_return = array();
$wp_query_pages = new wp_query(array('showposts' => -1, 'post_type' => 'page'));
while ($wp_query_pages->have_posts()) {
$wp_query_pages->the_post();
$page_custom_meta = get_post_custom($post->ID);
if (is_array($page_custom_meta) && array_key_exists('_ewf-page-sidebar', $page_custom_meta)) {
if ($page_custom_meta["_ewf-page-sidebar"][0] == $sidebar_id) {
$data_return[$post->ID] = "true";
update_post_meta($post->ID, "_ewf-page-sidebar", $default_id);
} else {
$data_return[$post->ID] = "false";
}
}
}
wp_reset_postdata();
return $data_return;
}
开发者ID:kadr,项目名称:semashko,代码行数:20,代码来源:ewf-modLayout.php
示例10: agatha_postsrelacionados
function agatha_postsrelacionados()
{
$orig_post = $post;
global $post;
$tags = wp_get_post_tags($post->ID);
if ($tags) {
$tag_ids = array();
foreach ($tags as $individual_tag) {
$tag_ids[] = $individual_tag->term_id;
}
$args = array('tag__in' => $tag_ids, 'post__not_in' => array($post->ID), 'posts_per_page' => 4, 'caller_get_posts' => 1);
$my_query = new wp_query($args);
?>
<section id="relatedPost">
<?php
while ($my_query->have_posts()) {
$my_query->the_post();
?>
<div class="col-md-3 col-xs-6 relatedPost">
<a rel="external" href="<?php
the_permalink();
?>
"><?php
the_post_thumbnail('miniatura');
?>
<br />
<?php
the_title();
?>
</a>
</div>
<?php
}
?>
</section>
<?php
}
$post = $orig_post;
wp_reset_query();
}
开发者ID:ericsoncardosoweb,项目名称:agatha-wp,代码行数:40,代码来源:post-relacionados.php
示例11: explode
<?php
if ($query != 'custom') {
if ($query == 'tag') {
$tags = explode(',', $tag);
foreach ($tags as $tag) {
$theTagId = get_term_by('name', $tag, 'post_tag');
if ($fea_tags) {
$sep = ' , ';
}
$fea_tags .= $sep . $theTagId->slug;
}
$args = array('tag' => $fea_tags, 'posts_per_page' => $number, 'no_found_rows' => 1);
} else {
$args = array('category__in' => $cat, 'posts_per_page' => $number, 'no_found_rows' => 1);
}
$breaking_query = new wp_query($args);
if ($breaking_query->have_posts()) {
$count = 0;
?>
<ul>
<?php
while ($breaking_query->have_posts()) {
$breaking_query->the_post();
$count++;
?>
<li><a href="<?php
the_permalink();
?>
" title="<?php
the_title();
?>
开发者ID:hongtien510,项目名称:gia_su,代码行数:31,代码来源:breaking-news.php
示例12: locate_template
<p>Tu solicitud se está tramitando en estos momentos. Te rogamos tengas paciencia.</p>
<?php
include locate_template('templates/sections/section-close.php');
?>
</div>
<?php
}
?>
<?php
if ($user_info->ID == get_current_user_id() && !is_user_role('subscriber')) {
?>
<?php
$args = array('order' => 'DESC', 'posts_per_page' => -1, 'post_type' => 'fee', 'orderby' => 'meta_value', 'meta_key' => 'fee_date_end');
$fee_query = new wp_query($args);
if ($fee_query->have_posts()) {
$html_info = '';
$html_warning = '';
while ($fee_query->have_posts()) {
$fee_query->the_post();
$fee_date_start = get_post_meta(get_the_ID(), 'fee_date_start', true);
$fee_date_end = get_post_meta(get_the_ID(), 'fee_date_end', true);
if (strtotime($fee_date_start) < time() && strtotime($fee_date_end) > time()) {
$members_payed = is_array(get_post_meta(get_the_ID(), 'members_payed', true)) ? get_post_meta(get_the_ID(), 'members_payed', true) : array();
$members_pending = is_array(get_post_meta(get_the_ID(), 'members_pending', true)) ? get_post_meta(get_the_ID(), 'members_pending', true) : array();
if ($members_payed[get_current_user_id()] == '') {
if ($members_pending[get_current_user_id()] != '') {
$html_info .= '<p>Cuota <a href="' . get_the_permalink() . '">' . get_the_title() . '</a> en proceso de validación</p>';
} else {
$html_warning .= '<p>Cuota <a href="' . get_the_permalink() . '">' . get_the_title() . '</a> pendiente de abono.</p>';
开发者ID:Saigesp,项目名称:wp-design-community,代码行数:31,代码来源:author.php
示例13: longform_the_related_posts
function longform_the_related_posts()
{
global $post;
$tags = wp_get_post_tags($post->ID);
if ($tags) {
$tag_ids = array();
foreach ($tags as $individual_tag) {
$tag_ids[] = $individual_tag->term_id;
}
$args = array('tag__in' => $tag_ids, 'post__not_in' => array($post->ID), 'posts_per_page' => 8, 'ignore_sticky_posts' => 1);
$my_query = new wp_query($args);
?>
<h2 class="related-articles-title"><?php
_e('Related articles', 'longform');
?>
</h2>
<div class="related-articles">
<?php
while ($my_query->have_posts()) {
$my_query->the_post();
?>
<div class="related-thumb col-sm-3 col-md-3 col-lg-3">
<a rel="external" href="<?php
the_permalink();
?>
">
<?php
the_post_thumbnail(array(500, 350));
?>
<div class="related-content">
<h2><?php
the_title();
?>
</h2>
</div>
</a>
</div>
<?php
}
?>
<div class="clearfix"></div>
</div>
<?php
}
wp_reset_postdata();
wp_reset_query();
}
开发者ID:joedavine,项目名称:room,代码行数:49,代码来源:functions.php
示例14: evolve_similar_posts
function evolve_similar_posts()
{
$post = '';
$orig_post = $post;
global $post;
$evolve_similar_posts = evolve_get_option('evl_similar_posts', 'disable');
if ($evolve_similar_posts == "category") {
$matchby = get_the_category($post->ID);
$matchin = 'category';
} else {
$matchby = wp_get_post_tags($post->ID);
$matchin = 'tag';
}
if ($matchby) {
$matchby_ids = array();
foreach ($matchby as $individual_matchby) {
$matchby_ids[] = $individual_matchby->term_id;
}
$args = array($matchin . '__in' => $matchby_ids, 'post__not_in' => array($post->ID), 'showposts' => 5, 'ignore_sticky_posts' => 1);
$my_query = new wp_query($args);
if ($my_query->have_posts()) {
echo '<div class="similar-posts"><h5>' . __('Similar posts', 'evolve') . '</h5><ul>';
while ($my_query->have_posts()) {
$my_query->the_post();
?>
<li>
<a href="<?php
the_permalink();
?>
" rel="bookmark" title="<?php
_e('Permanent Link to', 'evolve');
?>
<?php
the_title();
?>
">
<?php
if (get_the_title()) {
$title = the_title('', '', false);
$evolve_posts_excerpt_title_length = intval(evolve_get_option('evl_posts_excerpt_title_length', '40'));
echo evolve_truncate($title, $evolve_posts_excerpt_title_length, '...');
} else {
echo __("Untitled", "evolve");
}
?>
</a>
<?php
if (get_the_content()) {
?>
—
<small><?php
echo evolve_excerpt_max_charlength(60);
?>
</small> <?php
}
?>
</li>
<?php
}
echo '</ul></div>';
}
}
$post = $orig_post;
wp_reset_query();
}
开发者ID:berniecultess,项目名称:infirev,代码行数:66,代码来源:basic-functions.php
示例15: get_header
<?php
get_header();
/*
Template Name: People Page
*/
?>
<?php
$args = array('post_type' => 'people');
$people = new wp_query($args);
if ($people->have_posts()) {
while ($people->have_posts()) {
$people->the_post();
?>
<a class="btn btn-lg btn-primary" href="<?php
the_permalink();
?>
">
<img src="<?php
the_field('image');
?>
" alt="">
<?php
the_title();
?>
</a>
开发者ID:mariakhair,项目名称:bootstrap,代码行数:31,代码来源:page-people.php
示例16: widget
public function widget($args, $instance)
{
$javo_wg_testimonial_posts_args = array('post_type' => 'jv_testimonials', 'post_status' => 'publish', 'posts_per_page' => 3);
$javo_wg_testimonial_posts = new wp_query($javo_wg_testimonial_posts_args);
?>
<div class='row'>
<div class='col-md-12'>
<div class="carousel slide" data-ride="carousel" id="javo_wg_testimonial">
<!-- Carousel Slides / Quotes -->
<div class="carousel-inner">
<?php
if ($javo_wg_testimonial_posts->have_posts()) {
$i = 0;
while ($javo_wg_testimonial_posts->have_posts()) {
$i++;
$javo_wg_testimonial_posts->the_post();
?>
<div class="item<?php
echo $i == 1 ? ' active' : '';
?>
">
<div class="row">
<div class="col-sm-12">
<p><?php
the_content();
?>
</p>
</div>
</div>
<div class="row">
<div class="col-sm-6 text-center">
<?php
if (has_post_thumbnail()) {
the_post_thumbnail(array(80, 80), array('class' => 'img-circle javo_wg_testimonial-featured'));
}
?>
</div>
<div class="col-sm-6">
<h3><?php
printf('%s %s', get_the_author_meta('first_name'), get_the_author_meta('last_name'));
?>
</h3>
</div>
</div>
</div>
<?php
}
// End While
}
// End If
?>
</div>
<!-- Carousel Buttons Next/Prev -->
<a data-slide="prev" href="#javo_wg_testimonial" class="left carousel-control hidden-xs"><i class="fa fa-chevron-left"></i></a>
<a data-slide="next" href="#javo_wg_testimonial" class="right carousel-control hidden-xs"><i class="fa fa-chevron-right"></i></a>
<!-- Bottom Carousel Indicators -->
<ol class="carousel-indicators">
<li data-target="#javo_wg_testimonial" data-slide-to="0" class="active"></li>
<li data-target="#javo_wg_testimonial" data-slide-to="1"></li>
<li data-target="#javo_wg_testimonial" data-slide-to="2"></li>
</ol>
</div>
</div><!-- 12 Columns Close -->
</div><!-- Row Close -->
<?php
wp_reset_query();
}
开发者ID:redcypress,项目名称:lacecake,代码行数:69,代码来源:wg-javo-testimonial-slide.php
示例17: ratings
public function ratings($all = FALSE, $count = -1, $view_type = 'normal', $length = 0)
{
global $javo_tso, $javo_custom_item_label;
$javo_this_args = array("post_type" => "ratings", "post_status" => "publish", 'posts_per_page' => $count, "meta_query" => array(array("key" => "rating_parent_post_id", "compare" => "=", "type" => "NUMBERIC", "value" => $this->post->ID)));
if ($all) {
unset($javo_this_args['meta_query']);
}
$javo_rating_posts = new wp_query($javo_this_args);
ob_start();
?>
<div class="javo-rat-area row">
<div class="col-md-12">
<?php
if ($javo_rating_posts->have_posts()) {
while ($javo_rating_posts->have_posts()) {
$javo_rating_posts->the_post();
$this->user_average_score = get_post_meta(get_the_ID(), 'rating_average', true);
$this->parent_post_id = get_post_meta(get_the_ID(), 'rating_parent_post_id', true);
$this->parent_post = get_post($this->parent_post_id);
switch ($view_type) {
// Shortcode Display Type
case 'tab':
?>
<div class="row rating-wrap">
<div class="col-md-12">
<div class="row">
<div class="col-md-5">
<div class="rating-author pull-left">
<?php
if (get_the_author_meta('avatar')) {
echo wp_get_attachment_image(get_the_author_meta('avatar'), 'javo-tiny', 1, array('class' => 'img-circle'));
} else {
printf('<img src="%s" class="img-responsive wp-post-image img-circle" style="width:80px; height:80px;">', $javo_tso->get('no_image', JAVO_IMG_DIR . '/no-image.png'));
}
?>
<div class="rating-total"><?php
printf('%.1f', get_post_meta(get_the_ID(), 'rating_average', true));
?>
</div> <!-- rating-total -->
</div> <!-- rating-author -->
<div class="rating-each-details pull-left">
<?php
echo apply_filters('javo_rating_score_display', get_the_ID(), false);
?>
<!-- javo-rating-registed-score -->
</div> <!-- rating-each-details -->
</div>
<div class="rating-comments pull-left">
<a href="<?php
echo get_permalink($this->parent_post_id);
?>
#item-ratings"><span><?php
printf('%s %s', get_the_author_meta('first_name'), get_the_author_meta('last_name'));
?>
: </span>
<?php
if ((int) $length > 0) {
echo javo_str_cut(strip_tags(get_the_content()), $length);
} else {
echo strip_tags(get_the_content());
}
?>
</a>
</div> <!-- rating-comments -->
</div>
<div class="clearfix"></div>
</div> <!-- col-md-12 -->
</div>
<?php
break;
case 'detail':
?>
<ul class="list-group">
<li class="list-group-item">
<div class="row">
<div class="col-md-2 text-center">
<div><?php
echo wp_get_attachment_image(get_the_author_meta('avatar'), 'javo-tiny', 1, array('class' => 'img-circle'));
?>
</div>
</div>
<div class="col-md-5">
<?php
echo apply_filters('javo_rating_score_display', get_the_ID());
?>
</div>
<div class="col-md-5">
<a href="<?php
echo get_permalink($this->parent_post->ID);
?>
#item-ratings">
<h3><?php
echo $this->parent_post->post_title;
?>
</h3>
<p><?php
//.........这里部分代码省略.........
开发者ID:kaiifalcutela,项目名称:eatdk,代码行数:101,代码来源:javo-ratings.php
示例18: get_field
?>
</h2>
<?php
echo get_field('description_policy');
?>
<br/>
<h3><?php
echo get_field('category_subtitle_policy');
?>
</h3>
</div>
<div class="col-xs-12 col-sm-10 col-sm-push-1 items-holder">
<?php
// POLICY QUERY
$args3 = array('post_type' => 'resources', 'category__in' => 31, 'posts_per_page' => 4, 'orderby' => 'modified', 'tax_query' => array(array('taxonomy' => 'bhpn_theme', 'field' => 'id', 'terms' => '5')));
$query3 = new wp_query($args3);
$mini_args = array('post_type' => 'resources', 'tax_query' => array(array('taxonomy' => 'bhpn_theme', 'field' => 'id', 'terms' => '5')));
$mini_q = new wp_query($mini_args);
if (!$query3->have_posts()) {
get_template_part("content", "no-content");
}
while ($query3->have_posts()) {
$query3->the_post();
get_template_part("content", "item-small");
}
?>
</div>
<?php
if ($query3->have_posts()) {
?>
<div class="col-xs-12 col-sm-10 col-sm-push-1"><a href="/resources/?bhpn_theme=policy" class="orange-box">View All Resources (<?php
开发者ID:barkdesignchicago,项目名称:BHPN,代码行数:31,代码来源:content-page-resources.php
示例19: get_the_category
<!--<h3>Mais ></h3>-->
</div>
</article>
<!--Related Posts-->
<div class="relacionados">
<?php
$categories = get_the_category($post->ID);
if ($categories) {
$category_ids = array();
foreach ($categories as $individual_category) {
$category_ids[] = $individual_category->term_id;
}
$args = array('category__in' => $category_ids, 'post__not_in' => array($post->ID), 'showposts' => 5, 'caller_get_posts' => 1);
$my_query = new wp_query($args);
if ($my_query->have_posts()) {
$count = 1;
echo '<h3>Leia também:</h3><ul>';
while ($my_query->have_posts()) {
$my_query->the_post();
?>
<div class="box-relacionado <?php
if ($count == 4) {
echo "lest";
}
?>
">
<a title="<?php
the_title_attribute();
开发者ID:scardualucas,项目名称:quatrolados,代码行数:31,代码来源:index.php
示例20: wp_query
</li>
<?php
}
?>
</ul>
</nav>
</div><!--filter-wrap-->
<div class="container portfolio-item-main">
<div class="container-inner">
<div class="portfolio-item-wrapper">
<ul id="portfolio-items">
<?php
$query = new wp_query(array('post_type' => 'portfolio'));
while ($query->have_posts()) {
$query->the_post();
$slug = get_the_terms($post->ID, 'portfolio-category');
$new_slug = $slug[0]->slug;
//var_dump($new_slug);
?>
<li class="mix <?php
echo $new_slug;
?>
">
<div class="logo" style="background-image:url(<?php
echo wp_get_attachment_url(get_post_thumbnail_id($post->ID));
?>
)"></div>
<h3><?php
开发者ID:jackrabbit-design,项目名称:fischbach-moore,代码行数:31,代码来源:__portfolio-page.php
注:本文中的wp_query类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论