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; }
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; }
/** * 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(); } }
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; }
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; }
/** * 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 :)'; } }
/** * 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'); } }
/** * 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; } }
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; }
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(); }
<?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>'; }
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title']); echo $before_widget; if (!empty($title)) { if (!empty($instance['postlink'])) { if (get_option('show_on_front') == 'page') { $link = get_permalink(get_option('page_for_posts')); } else { $link = get_permalink(get_option('home')); } $before_title .= '<a href="' . $link . '">'; $after_title .= '</a>'; } echo $before_title . $title . $after_title; } $ul_classes = 'recent_posts_with_excerpts'; $ul_classes = apply_filters('recent_posts_with_excerpts_list_classes', $ul_classes); if (!empty($ul_classes)) { $ul_classes = ' class="' . $ul_classes . '"'; } $li_classes = ''; $li_classes = apply_filters('recent_posts_with_excerpts_item_classes', $li_classes); if (!empty($li_classes)) { $li_classes = ' class="' . $li_classes . '"'; } $h2_classes = 'recent_posts_with_excerpts'; $h2_classes = apply_filters('recent_posts_with_excerpts_heading_classes', $h2_classes); if (!empty($h2_classes)) { $h2_classes = ' class="' . $h2_classes . '"'; } do_action('recent_posts_with_excerpts_begin'); echo '<ul' . $ul_classes . '>'; // retrieve last n blog posts $q = array('posts_per_page' => $instance['numposts']); if (!empty($instance['ignore_sticky_posts'])) { $q["ignore_sticky_posts"] = $instance['ignore_sticky_posts']; } if (!empty($instance['cat'])) { $q['cat'] = $instance['cat']; } if (!empty($instance['offset']) && $instance['offset'] > 0) { $q['offset'] = $instance['offset']; } if (!empty($instance['tag'])) { $q['tag'] = $instance['tag']; } $q = apply_filters('recent_posts_with_excerpts_query', $q); $rpwe = new wp_query($q); $excerpts = $instance['numexcerpts']; $date = apply_filters('recent_posts_with_excerpts_date_format', $instance['date']); // the Loop if ($rpwe->have_posts()) { while ($rpwe->have_posts()) { $rpwe->the_post(); echo '<li' . $li_classes . '>'; if ($excerpts > 0 && $instance['thumb'] && $instance['thumbposition'] == 'above') { echo '<a href="' . get_permalink() . '">' . get_the_post_thumbnail(get_the_id(), $instance['thumbsize']) . '</a>'; } echo '<h2' . $h2_classes . '><a href="' . get_permalink() . '">' . get_the_title() . '</a></h2>'; if (!empty($date)) { echo '<h3 class="date">' . get_the_time($date) . '</h3>'; } if ($excerpts > 0) { // show the excerpt if ($instance['thumb'] && $instance['thumbposition'] == 'between') { echo '<a href="' . get_permalink() . '">' . get_the_post_thumbnail(get_the_id(), $instance['thumbsize']) . '</a>'; } ?> <blockquote> <?php // the excerpt of the post if (function_exists('the_excerpt_reloaded')) { the_excerpt_reloaded($instance['words'], $instance['tags'], 'content', FALSE, '', '', '1', ''); } else { the_excerpt(); } // this covers Advanced Excerpt as well as the built-in one if (!empty($instance['more_text'])) { ?> <p class="alignright"><small><a href="<?php the_permalink(); ?> "><?php echo $instance['more_text']; } ?> </a></small></p> </blockquote> <?php if ($excerpts > 0 && $instance['thumb'] && $instance['thumbposition'] == 'below') { echo '<a href="' . get_permalink() . '">' . get_the_post_thumbnail(get_the_id(), $instance['thumbsize']) . '</a>'; } $excerpts--; } ?> </li> <?php } } ?> </ul> <?php do_action('recent_posts_with_excerpts_end'); echo $after_widget; wp_reset_query(); }
} } ?> <!-- tabbed content --> <div class="tabbed-content post-tabs clear-block" id="post-tabs"> <?php if ($jquery && ($comments || comments_open() || pings_open() && $numPingBacks > 0)) { // no tabs if jquery is disabled ?> <!-- tab navigation (items must be in reverse order because of the tab-design) --> <div class="tabs-wrap clear-block"> <ul class="tabs"> <?php if ($rp_query && $rp_query->have_posts()) { ?> <li class="related-posts"><a href="#section-relatedPosts"><span><?php _e('Related Posts', 'mystique'); ?> </span></a></li><?php } ?> <?php if ($numPingBacks > 0) { ?> <li class="trackbacks"><a href="#section-trackbacks"><span><?php printf(__('Trackbacks (%s)', 'mystique'), $numPingBacks); ?> </span></a></li><?php }
function xborders_post_related() { $orig_post = $post; global $post; $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), 'posts_per_page' => 5, 'caller_get_posts' => 1, 'orderby' => 'rand'); $my_query = new wp_query($args); if ($my_query->have_posts()) { echo '<div id="xborders_related">'; echo '<span>Similar Post</span>'; echo '<div id="thumbnail_posts" class="clearfix">'; echo '<div class="container">'; while ($my_query->have_posts()) { $my_query->the_post(); ?> <div class="row"> <div class="col-md-2 col-sm-6 col-xs-12 text-left"> <a href="<?php the_permalink(); ?> " rel="bookmark" title="<?php the_title(); ?> "> <span class="h-thumnail"> <?php the_post_thumbnail(array(60, 60), array('class' => 'img-responsive')); ?> </span> </a> </div> <div class="col-md-10 c*k-sm-6 col-xs-12 blog-title text-left"> <a href="<?php the_permalink(); ?> " rel="bookmark" title="<?php the_title(); ?> "> <span class="h-title"> <?php the_title(); ?> </span> </a> </div> </div> <?php } echo '</div></div>'; } } $post = $orig_post; wp_reset_query(); }
esc_html_e('Similar Properties', 'reales'); ?> </h3> <?php $orig_post = $post; $orig_city = get_post_meta($post->ID, 'property_city', true); $orig_category = wp_get_post_terms($post->ID, 'property_category', array('fields' => 'ids')); $orig_type = wp_get_post_terms($post->ID, 'property_type_category', array('fields' => 'ids')); $exclude_ids = array($post->ID); $args = array('posts_per_page' => 4, 'post_type' => 'property', 'post_status' => 'publish', 'post__not_in' => $exclude_ids); if ($orig_type && $orig_category) { $args['tax_query'] = array('relation' => 'AND', array('taxonomy' => 'property_category', 'field' => 'id', 'terms' => $orig_category[0]), array('taxonomy' => 'property_type_category', 'field' => 'id', 'terms' => $orig_type[0])); } $args['meta_query'] = array(array('key' => 'property_city', 'value' => $orig_city)); $my_query = new wp_query($args); if ($my_query->have_posts() && $orig_type && $orig_category) { ?> <div class="row"> <?php while ($my_query->have_posts()) { $my_query->the_post(); $s_id = get_the_ID(); $s_link = get_permalink($s_id); $s_title = get_the_title($s_id); $s_gallery = get_post_meta($s_id, 'property_gallery', true); $s_images = explode("~~~", $s_gallery); $s_price = get_post_meta($s_id, 'property_price', true); $reales_general_settings = get_option('reales_general_settings'); $s_currency = isset($reales_general_settings['reales_currency_symbol_field']) ? $reales_general_settings['reales_currency_symbol_field'] : ''; $s_currency_pos = isset($reales_general_settings['reales_currency_symbol_pos_field']) ? $reales_general_settings['reales_currency_symbol_pos_field'] : ''; $s_price_label = get_post_meta($s_id, 'property_price_label', true);
function redwaves_related_posts() { $related_posts = get_theme_mod('related_posts', '1'); $related_posts_number = get_theme_mod('related_posts_number', '4'); $related_posts_query = get_theme_mod('related_posts_query', 'tags'); if ($related_posts && intval($related_posts_number) > 0 && intval($related_posts_number) <= 6) { if ($related_posts_query && $related_posts_query === 'tags') { global $post; $orig_post = $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' => $related_posts_number, 'ignore_sticky_posts' => 1, 'orderby' => 'rand'); $my_query = new wp_query($args); if ($my_query->have_posts()) { echo '<div id="related_posts" class="related-posts"><h3>' . esc_attr_e('Related Posts', 'redwaves-lite') . '</h3><ul>'; while ($my_query->have_posts()) { $my_query->the_post(); ?> <?php if (has_post_thumbnail()) { ?> <li><div class="horizontal-container"><div class="relatedthumb"><a href="<?php the_permalink(); ?> " rel="bookmark" title="<?php the_title_attribute(); ?> "><?php the_post_thumbnail('small'); ?> </a></div> <div class="post-data-container"><div class="post-title"><?php the_title(); ?> </div><div class="post-info"><div class="meta-info"> <?php redwaves_posted(); redwaves_entry_comments(); ?> </div></div></div></div></li> <?php } else { ?> <li><div class="horizontal-container"> <div class="relatedthumb"> <a href="<?php the_permalink(); ?> " rel="bookmark" title="<?php the_title_attribute(); ?> "> <img src="<?php echo get_template_directory_uri(); ?> /images/nothumb-120x120.png" width="120" height="120" alt="<?php the_title_attribute(); ?> " /> </a> </div> <div class="post-data"><div class="post-data-container"> <div class="post-title"><?php the_title(); ?> </div> <div class="post-info"><div class="meta-info"> <?php redwaves_posted(); redwaves_entry_comments(); ?> </div></div> </div></div> </div></li> <?php } ?> <?php } echo '</ul></div>'; } } $post = $orig_post; wp_reset_query(); } else { global $post; $orig_post = $post; $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), 'posts_per_page' => $related_posts_number, 'ignore_sticky_posts' => 1, 'orderby' => 'rand'); $my_query = new wp_query($args); if ($my_query->have_posts()) { echo '<div id="related_posts" class="related-posts"><h3>Related Posts</h3><ul>'; while ($my_query->have_posts()) { $my_query->the_post(); ?> <?php if (has_post_thumbnail()) { ?> <li><div class="horizontal-container"><div class="relatedthumb"><a href="<?php the_permalink(); ?> " rel="bookmark" title="<?php the_title_attribute(); ?> "><?php the_post_thumbnail('small'); ?> </a></div> <div class="post-data-container"><div class="post-title"><?php the_title(); ?> </div><div class="post-info"><div class="meta-info"> <?php redwaves_posted(); redwaves_entry_comments(); ?> </div></div></div></div></li> <?php } else { ?> <li><div class="horizontal-container"> <div class="relatedthumb"> <a href="<?php the_permalink(); ?> " rel="bookmark" title="<?php the_title_attribute(); ?> "> <img src="<?php echo get_template_directory_uri(); ?> /images/nothumb-120x120.png" width="120" height="120" alt="<?php the_title_attribute(); ?> " /> </a> </div> <div class="post-data"><div class="post-data-container"> <div class="post-title"><?php the_title(); ?> </div> <div class="post-info"><div class="meta-info"> <?php redwaves_posted(); redwaves_entry_comments(); ?> </div></div> </div></div> </div></li> <?php } ?> <?php } echo '</ul></div>'; } } $post = $orig_post; wp_reset_query(); } } }
</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(); ?>
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(); ?> "><?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 echo $mini_q->found_posts; ?> )</a></div><?php
$args = array('post_type' => 'staff', 'posts_per_page' => $posts_count, 'orderby' => 'rand', 'post__not_in' => array($post_id), 'no_found_rows' => true); // Query by terms $cats = wp_get_post_terms($post_id, 'staff_category'); $cats_ids = array(); foreach ($cats as $wpsp_related_cat) { $cats_ids[] = $wpsp_related_cat->term_id; } if (!empty($cats_ids)) { $args['tax_query'] = array(array('taxonomy' => 'staff_category', 'field' => 'id', 'terms' => $cats_ids, 'operator' => 'IN')); } // Apply filters to query args $args = apply_filters('wpsp_related_staff_args', $args); // Run Query - must be set to $wpex_related_query var!! $related_query = new wp_query($args); // If posts were found display related items if ($related_query->have_posts()) { ?> <section id="staff-single-related"> <?php $heading = $redux_wpsp['staff-post-related-title']; $heading = $heading ? $heading : esc_html__('Related Staff', 'learninginstitute'); // If Heading text isn't empty if ($heading) { ?> <h3><?php echo $heading; ?> </h3> <?php }
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 the_content(); ?> </p> </a> </div> </div><!-- Close Row --> </li><!-- Panel Body --> </ul><!-- Close Panel --> <?php break; // Single Item Page Type // Single Item Page Type case 'normal': default: ?> <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-2"> <?php echo apply_filters('javo_rating_score_display', get_the_ID()); ?> </div> <div class="col-md-8"> <span><?php the_content(); ?> </span> </div> </div><!-- Close Row --> </li><!-- Panel Body --> </ul><!-- Close Panel --> <?php } // End Switch } // End While; } else { _e('NO FOUND ' . $javo_custom_item_label->get('ratings', 'Ratings'), 'javo_fr'); } // End If ?> </div><!-- 12 Columns Close --> </div><!-- Rating Area Clse --> <script type="text/javascript"> jQuery(document).ready(function($){ "use strict"; $('.javo-rating-registed-score').each(function(k,v){ $(this).raty({ starOff: '<?php echo JAVO_IMG_DIR; ?> /star-off-s.png' , starOn: '<?php echo JAVO_IMG_DIR; ?> /star-on-s.png' , starHalf: '<?php echo JAVO_IMG_DIR; ?> /star-half-s.png' , half: true , readOnly: true , score: $(this).data('score') }); }); }); </script> <?php wp_reset_postdata(); $javo_this_content = ob_get_clean(); return $javo_this_content; }
public function javo_grid_open_callback($atts, $content = "") { global $javo_tso; extract(shortcode_atts(array('title' => '', 'sub_title' => '', 'title_text_color' => '#000', 'sub_title_text_color' => '#000', 'line_color' => '#fff', 'count' => 7), $atts)); $javo_this_args = array("post_type" => "item", "post_status" => "publish", 'posts_per_page' => $count); $javo_items_posts = new wp_query($javo_this_args); wp_enqueue_script("javo-grid_open-mo-js", JAVO_THEME_DIR . "/library/shortcodes/grid-open/js/modernizr.custom.js", array('jquery'), "1.0", false); wp_enqueue_script("javo-grid-js", JAVO_THEME_DIR . "/library/shortcodes/grid-open/js/grid.js", array('jquery'), "1.0", true); ob_start(); echo apply_filters('javo_shortcode_title', $title, $sub_title, array('title' => 'color:' . $title_text_color . ';', 'subtitle' => 'color:' . $sub_title_text_color . ';', 'line' => 'border-color:' . $line_color . ';')); ?> <div class="javo-grid-open"> <!-- Codrops top bar --> <div class="main"> <ul id="og-grid" class="og-grid"> <?php if ($javo_items_posts->have_posts()) { while ($javo_items_posts->have_posts()) { $javo_items_posts->the_post(); $javo_this_post_thumbnail_meta = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); $javo_this_post_thumbnail = $javo_this_post_thumbnail_meta[0]; ?> <li data-more-string="<?php _e('More', 'javo_fr'); ?> "> <a href="<?php the_permalink(); ?> " data-largesrc="<?php echo $javo_this_post_thumbnail; ?> " data-title="<?php the_title(); ?> " data-description="<?php the_excerpt(); ?> "> <?php the_post_thumbnail('thumbnail'); ?> </a> <!-- <div class="og-grid-onbutton"> <a href="<?php the_permalink(); ?> ">View </a> <a href="<?php the_permalink(); ?> ">Detail</a> </div>og-grid-onbutton <div class="og-grid-hover-wrap"> </div> --> </li> <?php } // End While } // End If ?> </ul> </div> </div><!-- /container --> <script> jQuery(function($) { "use strict"; Grid.init(); }); </script> <?php wp_reset_query(); $content = ob_get_clean(); return $content; }
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(); }
<?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 the_title();
<?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>
<?php /* * Template Name: Portfolio Two */ get_header(); ?> <section class="container"> <div class="portfolio-v2 clear"> <?php //$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $aProjectArgs = array('post_type' => 'uni_project', 'posts_per_page' => -1, 'orderby' => 'menu_order', 'order' => 'asc'); $oProjectQuery = new wp_query($aProjectArgs); if ($oProjectQuery->have_posts()) { $i = 1; while ($oProjectQuery->have_posts()) { $oProjectQuery->the_post(); ?> <?php if ($i == 1 || $i % 7 == 0) { ?> <!-- Start row --><!--<?php echo $i; ?> --> <a href="<?php the_permalink(); ?> " class="portfolioItemV2 portfolioLeftItem"> <?php
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(); }
public function javo_testimonial_callback($atts, $content = '') { global $javo_tso; extract(shortcode_atts(array('count' => 0, 'title' => '', 'sub_title' => '', 'title_text_color' => '#000', 'sub_title_text_color' => '#000', 'line_color' => '#fff', 'text_color' => '#454545', 'font_size' => 12), $atts)); wp_enqueue_script('javo-carousel-feedback-js', JAVO_THEME_DIR . '/library/shortcodes/javo-testimonial/javo-testimonial.js', '1.0', false); wp_enqueue_style('javo-carousel-feedback-css', JAVO_THEME_DIR . '/library/shortcodes/javo-testimonial/javo-testimonial.css', '1.0'); $javo_testimonial_args = array('post_type' => 'jv_testimonials', 'post_status' => 'publish', 'posts_per_page' => (int) $count <= 0 ? -1 : $count); $javo_testimonial_posts = new wp_query($javo_testimonial_args); ob_start(); ?> <?php echo apply_filters('javo_shortcode_title', $title, $sub_title, array('title' => 'color:' . $title_text_color . ';', 'subtitle' => 'color:' . $sub_title_text_color . ';', 'line' => 'border-color:' . $line_color . ';')); ?> <div class='javo_testimonial'> <div class='row'> <div class='col-md-12'> <div class='carousel slide' data-ride='carousel' id='javo_testimonial_carousel'> <!-- Bottom Carousel Indicators --> <ol class='carousel-indicators'> <li data-target='#javo_testimonial_carousel' data-slide-to='0' class='active'></li> <li data-target='#javo_testimonial_carousel' data-slide-to='1'></li> <li data-target='#javo_testimonial_carousel' data-slide-to='2'></li> </ol> <!-- Carousel Slides / Quotes --> <div class='carousel-inner'> <?php if ($javo_testimonial_posts->have_posts()) { $i = 0; while ($javo_testimonial_posts->have_posts()) { $i++; $javo_testimonial_posts->the_post(); ?> <div class="item<?php echo $i == 1 ? ' active' : ''; ?> "> <blockquote> <div class="row"> <div class="col-sm-3 text-center"> <?php if (has_post_thumbnail()) { the_post_thumbnail(array(100, 100), array('class' => 'img-circle')); } else { printf('<img src="%s" class="img-circle">', $javo_tso->get('no_image', JAVO_IMG_DIR . '/no-image.png')); } ?> </div> <div class="col-sm-8 col-offset-sm-2 javo-testimonial-cotent"> <?php the_content(); ?> <br> <span><?php the_author_meta('first_name'); the_author_meta('last_name'); ?> </span> </div> </div> </blockquote> </div> <?php } // End While } ?> </div> <!-- Carousel Buttons Next/Prev --> <a data-slide="prev" href="#javo_testimonial_carousel" class="left carousel-control"><i class="fa fa-chevron-left"></i></a> <a data-slide="next" href="#javo_testimonial_carousel" class="right carousel-control"><i class="fa fa-chevron-right"></i></a> </div> </div> </div> <?php printf('<style type="text/css">.javo-testimonial-cotent p, .javo-testimonial-cotent span{ font-size:%spx; color:%s;}</style>', (int) $font_size <= 12 ? 12 : $font_size, $text_color); ?> </div> <?php wp_reset_query(); $content = ob_get_clean(); return $content; }
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(); }
/** * generate_posts() * * This method fetches all the WP posts based on the widget settings, using the WP_query method. * * @author Luca Grandicelli <*****@*****.**> * @copyright (C) 2011-2014 Luca Grandicelli * @package special-recent-posts-free * @version 2.0.4 * @access private * @return object It returns the WP_query object containing the fetched posts. */ private function generate_posts() { // Defining widget args array. $args = array(); /** * ******************************************************** * DEFAULT OPTIONS * ******************************************************** */ // Checking for 'Compatibility Mode' option. if ('yes' == $this->plugin_args["srp_compatibility_mode"]) { // Compatibility mode filter. This might cause unknown problems. Deactivate it just in case. $args['suppress_filters'] = false; } // Ignore sticky posts $args['ignore_sticky_posts'] = 1; /** * ******************************************************** * BASIC OPTIONS * ******************************************************** */ // Post Type $args['post_type'] = $this->widget_args["post_type"]; // Checking for Post Type if ('page' == $args['post_type']) { // Post Parent $args['post_parent'] = 0; } // Post per Page $args['posts_per_page'] = 'yes' == $this->widget_args['show_all_posts'] ? -1 : $this->widget_args['post_limit']; // Checking for 'Show Sticky Posts' option. if ('yes' == $this->widget_args["show_sticky_posts"]) { // Ignore Sticky Posts. $args['ignore_sticky_posts'] = 0; } /** * ******************************************************** * POST OPTIONS * ******************************************************** */ // Checking for 'Post Order' option. switch ($this->widget_args['post_order']) { case "ASC": case "DESC": // Ordering posts by ASC/DESC order $args['order'] = $this->widget_args['post_order']; break; default: // Default behaviour: ordering by DESC. $args['order'] = 'DESC'; break; } // Checking for 'Random Mode' option. if ('yes' == $this->widget_args['post_random']) { // Applying random order by. $args['orderby'] = 'rand'; } /** * ******************************************************** * ADVANCED POST OPTIONS 1 * ******************************************************** */ // Checking for 'Hide Current Viewed Post' option. if ('yes' == $this->widget_args["post_current_hide"] && (is_single() || is_page())) { // Filtering current post from visualization. $args['post__not_in'] = array($this->singleID); } // Checking for 'Post Offset' option. if (0 !== $this->widget_args['post_offset']) { // Applying Post Offset. $args['offset'] = $this->widget_args['post_offset']; } /** * ******************************************************** * FILTERING OPTIONS * ******************************************************** */ // Checking for 'Category Filter' option. if (!empty($this->widget_args["category_include"])) { // Category Filter $args['cat'] = $this->widget_args['category_include']; } // Checking for 'Posts/Page ID Filter' option. if (!empty($this->widget_args['post_include'])) { // Including result posts by post IDs. $args['post__in'] = explode(',', $this->widget_args['post_include']); } // Checking for 'Exclude Posts/Pages By IDs' option. if (!empty($this->widget_args['post_exclude'])) { // Excluding result posts by post IDs. $args['post__not_in'] = explode(',', $this->widget_args['post_exclude']); } // Checking for 'Custom Post Type' option. if (!empty($this->widget_args['custom_post_type'])) { // Setting post type as custom post type. $args['post_type'] = explode(',', $this->widget_args['custom_post_type']); } // Post Status $args['post_status'] = $this->widget_args["post_status"]; // WP_querying the database. $result_posts = new wp_query($args); // Checking if the result posts array is empty. if (!$result_posts->have_posts()) { // No posts available. Return false. return false; } // Returning result array. return $result_posts; }