function post_excerpts_here() { //posts with date, author, time, content excerpts, and title.. if (have_posts()) { while (have_posts()) { echo '<div class="excerpt-div">'; the_post(); echo '<h2 class="post-title"><a href="'; the_permalink(); echo '" title="'; the_title(); echo '">'; the_title(); echo '</a></h2>'; echo '<h4 class="post-info">'; echo 'Created on '; the_date(); echo ' at '; the_time(); echo ' by '; the_author_meta(first_name); echo '.</h4>'; echo '<p class="post-excerpt">'; the_excerpt(); echo '</p>'; echo '</div>'; } // end while } // end if }
/** * Custom render function for Infinite Scroll. */ function us_web_standards_infinite_scroll_render() { while (have_posts()) { the_post(); get_template_part('template-parts/content', get_post_format()); } }
/** * Custom render function for Infinite Scroll. */ function doublecheeseburger_infinite_scroll_render() { while (have_posts()) { the_post(); get_template_part('template-parts/content', get_post_format()); } }
function featured_index() { $output = ''; $args = array('tag' => 'featured', 'posts_per_page' => 3); query_posts($args); if (have_posts()) { while (have_posts()) { the_post(); $the_img = $this->get_img_src(get_the_ID()); if ($the_img == 'zero') { } $output .= '<div class=" mdl-cell mdl-cell--4-col mdl-card mdl-shadow--2dp">'; $output .= ' <div class="mdl-card__title mdl-card--expand" style="background-image: url( \' ' . $the_img . ' \' )"> </div> <div class="mdl-card__supporting-text"> ' . get_the_title() . ' </div> <div class="mdl-card__actions mdl-card--border"> <a class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect"> View Updates </a> </div>'; $output .= '</div>'; } } else { $output = 'gagal'; } wp_reset_query(); return $output; }
/** * Custom render function for Infinite Scroll. */ function component_s_infinite_scroll_render() { while (have_posts()) { the_post(); get_template_part('components/content', get_post_format()); } }
/** * Custom render function for Infinite Scroll. */ function abc_nuorisotominta_infinite_scroll_render() { while (have_posts()) { the_post(); get_template_part('template-parts/content', get_post_format()); } }
function get_child_pages() { global $post; rewind_posts(); // stop any previous loops query_posts(array('post_type' => 'page', 'posts_per_page' => -1, 'post_status' => publish, 'post_parent' => $post->ID, 'order' => 'ASC', 'orderby' => 'menu_order')); // query and order child pages while (have_posts()) { the_post(); $childPermalink = get_permalink($post->ID); // post permalink $childID = $post->ID; // post id $childTitle = $post->post_title; // post title $childExcerpt = $post->post_excerpt; // post excerpt echo '<article id="page-excerpt-' . $childID . '" class="box-left">'; echo '<div class="section-box">'; echo '<p id="button"><a href="' . $childPermalink . '">' . $childTitle . '</a></p>'; echo '</div>'; echo '<div class="section-boxes">'; echo '<p id>' . $childExcerpt . ' <a href="' . $childPermalink . '">'; ?> <i class="fa fa-arrow-circle-right"></i> <?php '</a></p>'; echo '</div>'; echo '</article>'; } // reset query wp_reset_query(); }
/** * Template for BuddyPress pages * * @package ThemifyFlow * @since 1.0.0 */ function tf_buddypress() { while (have_posts()) { the_post(); the_content(); } }
/** *主文章列表 *http://www.bgbk.org */ function Bing_posts_list() { if (have_posts()) { echo '<ul class="posts-list">'; while (have_posts()) { the_post(); Bing_posts_list_loop(); } echo '</ul>'; Bing_page_navi(array('before' => '<div class="span12 posts-list-page-navi"><div class="panel page-navi">', 'after' => '</div></div>')); Bing_mobile_page_navi(); } else { ?> <div class="empty-posts-list span12"> <article class="panel"> <?php echo '<p>'; if (is_home()) { _e('这里什么都没有', 'Bing'); echo '</p>'; } elseif (is_search()) { _e('没有搜索到任何结果', 'Bing'); echo '</p>'; } else { _e('这里什么都没有,你也许可以使用搜索功能找到你需要的内容:', 'Bing'); echo '</p>'; get_search_form(); } ?> </article> </div> <?php } }
/** * Display the Open Graph meta tags. * Add more to this if needed. * * See: https://developers.facebook.com/docs/sharing/webmasters and http://ogp.me/ */ function skeleton_og_meta_tags() { if (is_single() || is_page()) { if (have_posts()) { while (have_posts()) { the_post(); ?> <meta name="og:description" content="<?php the_excerpt_rss(); ?> "> <meta name="og:image" content="<?php echo skeleton_get_thumbnail_src(get_post_thumbnail_id()); ?> "> <?php } } } elseif (is_home()) { ?> <meta name="og:description" content="<?php bloginfo('description'); ?> "> <?php } }
public static function friend_list_func($atts, $content = "") { $atts = shortcode_atts(array('per_page' => '100'), $atts, 'friend_list'); $return = ""; query_posts(array('post_type' => 'friend', 'showposts' => $atts['per_page'], 'meta_query' => array('relation' => 'AND', array('key' => 'avatar150', 'value' => 'https://static0.fitbit.com/images/profile/defaultProfile_100_male.gif', 'compare' => 'NOT LIKE'), array('key' => 'avatar150', 'value' => 'https://static0.fitbit.com/images/profile/defaultProfile_100_female.gif', 'compare' => 'NOT LIKE')))); if (have_posts()) { while (have_posts()) { the_post(); $displayName = get_post_meta(get_the_id(), 'displayName', true); $avatar = get_post_meta(get_the_id(), 'avatar150', true); $return .= sprintf('<div class="col-lg-3 col-sm-3 focus-box"> <div class="service-icon"> <i style="background:url(%s) no-repeat center;width:100%%; height:100%%;" class="pixeden"></i> </div> <h3 class="red-border-bottom">%s</h3> <a class="btn btn-primary btn-block green-btn btn-sm" href="https://www.fitbit.com/user/%s"><i class="fa fa-plus"></i> Add Friend</a> <br/> </div>', $avatar, $displayName, get_the_title(), get_the_content()); } $return = '<div class="hwd-wrapper"><div class="row">' . $return . '</div></div>'; } else { $return = 'No Friends Found'; } wp_reset_query(); return $return; }
function widget($args, $instance) { if (!is_home()) { return false; } /* Query the first post: If it has a featured image, display it, and store its ID in an array. */ query_posts('posts_per_page=1'); while (have_posts()) { the_post(); $do_not_duplicate[] = $post->ID; get_template_part('feature', 'index'); } /* Excerpt post loop. If a #feature post exists, do not duplicate. */ if ((int) $instance['excerpts_count'] > 0) { query_posts(array('post__not_in' => $do_not_duplicate, 'offset' => 1, 'posts_per_page' => (int) $instance['excerpts_count'])); echo '<div class="clearfix">'; for ($post_count = 1; have_posts(); $post_count++) { the_post(); $do_not_duplicate[] = $post->ID; /* See: lib/helpers.php -> sourdough_excerpt() */ sourdough_excerpt($post_count); } echo '</div>'; } wp_reset_query(); }
function get_loadmore() { global $wp_query; if (isset($_REQUEST['nonce']) && wp_verify_nonce($_REQUEST['nonce'], 'load_more')) { $post_type = get_query_var('post_type'); $paged = (int) $_REQUEST['page']; $per_page = 5; # Check if post_type set as $_REQUEST if (isset($_REQUEST['post_type'])) { $post_type = $_REQUEST['post_type']; } if (isset($_REQUEST['per_page'])) { $per_page = (int) $_REQUEST['per_page']; } $args = array('post_type' => $post_type, 'paged' => $paged, 'posts_per_page' => $per_page); $wp_query = new WP_Query($args); if (have_posts()) { while (have_posts()) { the_post(); get_template_part('content', get_post_type()); } } exit; } }
/** * list post with template by default query * @since 1.0 * @author Dakachi */ function ae_default_list_post() { global $ae_post_factory; if (have_posts()) { // post list echo '<ul>'; while (have_posts()) { the_post(); global $post; $object = $ae_post_factory->get($post->post_type); $convert = $object->convert($post); $json_data[] = $convert; // get post type item template ae_post_template_part('template/loop', $post->post_type); } echo '</ul>'; // print js template for post item ae_post_template_part('template-js/loop', $post->post_type); // print post array json data if (!isset($args['json_id'])) { $args['json_id'] = 'ae-' . $post->post_type . '-json'; } echo '<script type="json/data" id="' . $args['json_id'] . '"> ' . json_encode($json_data) . ' </script>'; } }
function categori_news(){ query_posts('cat=9&showposts=10&posts_per_page=3'); while (have_posts()) : the_post(); /*Dima insert*/the_excerpt(); ?> <div class="content-box"> <div class="bgr01"><div class="bgr02"><div class="bgr03"> <div <?php post_class() ?> id="post-<?php the_ID(); ?>" style=" float:none; "> <div class="title"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> <div class="date_all"> <?php the_time('l, j ?F, Y') ?> </div> <div class="post"> Написал <?php the_author_link() ?> <?php the_time('g:i A') ?> </div> </div> <div class="content_box"> <?php the_content('Читать всё'); ?> </div> <div class="postmetadata"><?php the_tags('Tags: ', ', ', '<br />'); ?></div> <div class="comments"><?php comments_popup_link('0 комментарии', 'комментарии', '% комментарии '); ?></div> <div class="link-edit"><?php edit_post_link('Edit', ''); ?></div> </div> </div></div></div> </div> <?php endwhile;}
/** * Custom render function for Infinite Scroll. */ function redemptive_developments_infinite_scroll_render() { while (have_posts()) { the_post(); get_template_part('template-parts/content', get_post_format()); } }
function show_category($cid = 1) { $args = array('showposts' => 4, 'cat' => $cid, 'orderby' => 'post_date', 'order' => 'desc'); query_posts($args); global $the_post; $category = ''; while (have_posts()) { the_post(); $cat = get_the_category(get_the_ID()); $link = get_permalink(get_the_ID()); $src = get_the_post_thumbnail(get_the_ID(), 'index_thumb'); $c_name = $cat[0]->name; $title = get_the_title(); echo $category .= <<<EOF <div class="box"> <a href="{$link}"> <div class="boximg">{$src}</div> <div class="category">{$c_name}</div> <p>{$title}</p> </a> </div> EOF; } wp_reset_query(); return $category; }
function noelie_homepage_content() { while (have_posts()) { the_post(); get_template_part('content', 'page'); } }
function ajax_navigation_callback() { global $wp_query, $page_no, $loop, $query; // this is how you get access to the database $loop = empty($_POST['loop']) ? 'loop' : $_POST['loop']; $posts_per_page = get_option('posts_per_page'); //merge the query array and paged $query = $_POST; unset($query['action']); unset($query['loop']); ob_start(); # Load the posts if ($loop) { query_posts($query); while (have_posts()) { the_post(); get_template_part($loop); } } $buffer = ob_get_contents(); ob_end_clean(); echo $buffer; exit; // this is required to return a proper result }
/** * Custom render function for Infinite Scroll. */ function chuchadon_infinite_scroll_render() { while (have_posts()) { the_post(); get_template_part('template-parts/content', post_type_supports(get_post_type(), 'post-formats') ? get_post_format() : get_post_type()); } }
/** * Adds custom classes to the array of body classes. * * @param array $classes Classes for the body element. * @return array */ function ultra_body_classes($classes) { // Adds a class of group-blog to blogs with more than 1 published author. if (is_multi_author()) { $classes[] = 'group-blog'; } // Adds a class of content-none if there are no posts. if (!have_posts()) { $classes[] = 'content-none'; } // Add widget-dependent classes. if (!is_active_sidebar('sidebar-1')) { $classes[] = 'one-column'; } // Add a class if the sidebar is use. if (is_active_sidebar('sidebar-1')) { $classes[] = 'sidebar'; } // Add a class if viewed on mobile. if (wp_is_mobile()) { $classes[] = 'mobile-device'; } if (siteorigin_setting('header_tagline')) { $classes[] = 'tagline'; } // Add a class if the page slider overlap is true. if (get_post_meta(get_the_ID(), 'ultra_metaslider_slider_overlap', true) == true) { $classes[] = 'overlap'; } return $classes; }
/** * Callback for rendering posts during infinite scroll. */ function eventbrite_venue_infinite_scroll_render() { while (have_posts()) { the_post(); get_template_part('tmpl/post-loop'); } }
/** * @param array $args * @param array $instance */ function widget($args, $instance) { if (empty($instance['template'])) { return; } if (is_admin()) { return; } echo $args['before_widget']; $instance['title'] = apply_filters('widget_title', $instance['title'], $instance, $this->id_base); if (!empty($instance['title'])) { echo $args['before_title'] . $instance['title'] . $args['after_title']; } if (strpos('/' . $instance['template'], '/content') !== false) { while (have_posts()) { the_post(); locate_template($instance['template'], true, false); } } else { locate_template($instance['template'], true, false); } echo $args['after_widget']; // Reset everything rewind_posts(); wp_reset_postdata(); }
function checkout_render_infinite_posts() { while (have_posts()) { the_post(); get_template_part('partials/content-standard'); } }
/** * Loop for Infinite Scroll */ function alienship_infinite_scroll_init() { while (have_posts()) { the_post(); get_template_part('/templates/parts/content', get_post_format()); } }
/** * Custom render function for Infinite Scroll. */ function portarlington_cce_infinite_scroll_render() { while (have_posts()) { the_post(); get_template_part('template-parts/content', get_post_format()); } }
/** * Render infinite posts by using template parts * @since 1.0.0 */ function kouki_render_infinite_posts() { while (have_posts()) { the_post(); get_template_part('content', 'masonry'); } }
function zp_custom_blog_page() { global $post, $paged; $include = genesis_get_option('blog_cat'); $exclude = genesis_get_option('blog_cat_exclude') ? explode(',', str_replace(' ', '', genesis_get_option('blog_cat_exclude'))) : ''; if (get_query_var('paged')) { $paged = get_query_var('paged'); } elseif (get_query_var('page')) { $paged = get_query_var('page'); } else { $paged = 1; } //* Arguments $args = array('cat' => $include, 'category__not_in' => $exclude, 'posts_per_page' => genesis_get_option('blog_cat_num'), 'paged' => $paged); query_posts($args); if (have_posts()) { while (have_posts()) { the_post(); do_action('genesis_before_entry'); printf('<article %s>', genesis_attr('entry')); // check post format and call template $format = get_post_format(); get_template_part('content', $format); do_action('genesis_after_entry_content'); //do_action( 'genesis_entry_footer' ); echo '</article>'; do_action('genesis_after_entry'); } } //* Genesis navigation genesis_posts_nav(); //* Restore original query wp_reset_query(); }
/** * Custom render function for Infinite Scroll. */ function brewery_infinite_scroll_render() { while (have_posts()) { the_post(); get_template_part('template-parts/content', get_post_format()); } }
static function render_form($id, $update, $second_category, $second_field_group) { while (have_posts()) { the_post(); acf_form(array('post_id' => $id, 'new_post' => array('post_category' => array(4, $second_category), 'post_status' => 'publish'), 'field_groups' => array(1065, $second_field_group, 1131), 'post_title' => true, 'submit_value' => 'Submit', 'updated_message' => $update)); } }