function zp_custom_archive_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'))) : ''; $paged = get_query_var('paged') ? get_query_var('paged') : 1; 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(); }
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(); }
/** * The template for displaying Listing Archive pages * * @link http://codex.wordpress.org/Template_Hierarchy * * @package WP Listings * @since 0.1.0 */ function archive_listing_loop() { global $post; $count = 0; // start counter at 0 // Uncomment to use term image in your theme // echo '<div class="wp-listings-term-image">' . wp_listings_term_image(get_queried_object()->term_id, true, 'full') . '</div>'; // Start the Loop. while (have_posts()) { the_post(); $count++; // add 1 to counter on each loop $first = $count == 1 ? 'first' : ''; // if counter is 1 add class of first $loop = sprintf('<div class="listing-widget-thumb"><a href="%s" class="listing-image-link">%s</a>', get_permalink(), get_the_post_thumbnail($post->ID, 'listings')); if ('' != wp_listings_get_status()) { $loop .= sprintf('<span class="listing-status %s">%s</span>', strtolower(str_replace(' ', '-', wp_listings_get_status($post->ID, 1))), wp_listings_get_status()); } $loop .= sprintf('<div class="listing-thumb-meta">'); if ('' != get_post_meta($post->ID, '_listing_text', true)) { $loop .= sprintf('<span class="listing-text">%s</span>', get_post_meta($post->ID, '_listing_text', true)); } elseif ('' != wp_listings_get_property_types()) { $loop .= sprintf('<span class="listing-property-type">%s</span>', wp_listings_get_property_types()); } if ('' != get_post_meta($post->ID, '_listing_price', true)) { $loop .= sprintf('<span class="listing-price">%s</span>', get_post_meta($post->ID, '_listing_price', true)); } $loop .= sprintf('</div><!-- .listing-thumb-meta --></div><!-- .listing-widget-thumb -->'); if ('' != get_post_meta($post->ID, '_listing_open_house', true)) { $loop .= sprintf('<span class="listing-open-house">Open House: %s</span>', get_post_meta($post->ID, '_listing_open_house', true)); } $loop .= sprintf('<div class="listing-widget-details"><h3 class="listing-title"><a href="%s">%s</a></h3>', get_permalink(), get_the_title()); $loop .= sprintf('<p class="listing-address"><span class="listing-address">%s</span><br />', wp_listings_get_address()); $loop .= sprintf('<span class="listing-city-state-zip">%s, %s %s</span></p>', wp_listings_get_city(), wp_listings_get_state(), get_post_meta($post->ID, '_listing_zip', true)); if ('' != get_post_meta($post->ID, '_listing_bedrooms', true) || '' != get_post_meta($post->ID, '_listing_bathrooms', true) || '' != get_post_meta($post->ID, '_listing_sqft', true)) { $loop .= sprintf('<ul class="listing-beds-baths-sqft"><li class="beds">%s<span>Beds</span></li> <li class="baths">%s<span>Baths</span></li> <li class="sqft">%s<span>Sq ft</span></li></ul>', get_post_meta($post->ID, '_listing_bedrooms', true), get_post_meta($post->ID, '_listing_bathrooms', true), get_post_meta($post->ID, '_listing_sqft', true)); } $loop .= sprintf('</div><!-- .listing-widget-details -->'); $loop .= sprintf('<a href="%s" class="button btn-primary more-link">%s</a>', get_permalink(), __('View Listing', 'wp_listings')); /** wrap in div with column class, and output **/ printf('<article id="post-%s" class="listing entry one-third %s"><div class="listing-wrap">%s</div><!-- .listing-wrap --></article><!-- article#post-## -->', get_the_id(), $first, apply_filters('wp_listings_featured_listings_widget_loop', $loop)); if (3 == $count) { // if counter is 3, reset to 0 $count = 0; } } if (function_exists('equity')) { equity_posts_nav(); } elseif (function_exists('genesis_init')) { genesis_posts_nav(); } else { wp_listings_paging_nav(); } }
function source__knowledgebase_loop() { $paged = get_query_var('paged') ? get_query_var('paged') : 1; if ($paged == 1) { $catId = get_cat_ID('Featured'); $args = array('cat' => $catId, 'posts_per_page' => 8, 'post_type' => 'post', 'paged' => 1); global $wp_query; $wp_query = new WP_Query($args); if ($wp_query->have_posts()) { echo '<div class="banner banner--featured">Featured Articles</div>'; while ($wp_query->have_posts()) { $wp_query->the_post(); global $post; $classes = 'article one-half entry'; if ($wp_query->current_post % 2 == 0) { $classes .= ' first'; } source__the_article($classes); } echo '<div style="clear: both;"></div>'; } wp_reset_query(); } /* If first page then show Features */ /* now list out recent knowledgebase articles */ $catId = get_cat_ID('Knowledgebase'); $args = array('cat' => $catId, 'posts_per_page' => 8, 'post_type' => 'post', 'paged' => $paged); global $wp_query; $wp_query = new WP_Query($args); if ($wp_query->have_posts()) { echo '<div class="banner banner--knowledgebase">Knowledgebase Articles</div>'; while ($wp_query->have_posts()) { $wp_query->the_post(); global $post; $classes = 'one-half entry'; if ($wp_query->current_post % 2 == 0) { $classes .= ' first'; } source__the_article($classes); } genesis_posts_nav(); } wp_reset_query(); }
/** * Add in the Post Navigation * * @since 1.0.0 * * @return null */ public function do_post_nav() { genesis_posts_nav(); }
/** * Creates Widget Output * * @author Nick Croft * @since 0.1 * @version 0.5 * @param array $args * @param array $instance */ function widget($args, $instance) { global $gfwa_counter; $gfwa_counter = 0; extract($args); /** Merge with defaults */ $instance = wp_parse_args((array) $instance, $this->defaults); echo $before_widget; add_filter('post_class', 'gfwa_post_class'); if (!empty($instance['posts_offset']) && !empty($instance['paged'])) { add_filter('post_limits', 'gfwa_post_limit'); } else { remove_filter('post_limits', 'gfwa_post_limit'); } // Set up the author bio if (!empty($instance['title'])) { echo $before_title . apply_filters('widget_title', $instance['title']) . $after_title; } $term_args = array(); if (!empty($instance['page_id'])) { $term_args['page_id'] = $instance['page_id']; } if (!empty($instance['posts_term'])) { $posts_term = explode(',', $instance['posts_term']); if ($posts_term['0'] == 'category') { $posts_term['0'] = 'category_name'; } if ($posts_term['0'] == 'post_tag') { $posts_term['0'] = 'tag'; } if (isset($posts_term['1'])) { $term_args[$posts_term['0']] = $posts_term['1']; } } if (!empty($posts_term['0'])) { if ($posts_term['0'] == 'category_name') { $taxonomy = 'category'; } elseif ($posts_term['0'] == 'tag') { $taxonomy = 'post_tag'; } else { $taxonomy = $posts_term['0']; } } else { $taxonomy = 'category'; } if (!empty($instance['exclude_terms'])) { $exclude_terms = explode(',', str_replace(' ', '', $instance['exclude_terms'])); $term_args[$taxonomy . '__not_in'] = $exclude_terms; } $page = ''; if (!empty($instance['paged'])) { $page = get_query_var('paged'); } if (!empty($instance['posts_offset'])) { global $myOffset; $myOffset = $instance['posts_offset']; $term_args['offset'] = $myOffset; } if (!empty($instance['post_id'])) { $IDs = explode(',', str_replace(' ', '', $instance['post_id'])); if ($instance['include_exclude'] == 'include') { $term_args['post__in'] = $IDs; } else { $term_args['post__not_in'] = $IDs; } } gfwa_before_loop($instance); if ($instance['posts_num'] != 0) { $query_args = array_merge($term_args, array('post_type' => $instance['post_type'], 'posts_per_page' => $instance['posts_num'], 'orderby' => $instance['orderby'], 'order' => $instance['order'], 'meta_key' => $instance['meta_key'], 'paged' => $page)); $query_args = apply_filters('gfwa_query_args', $query_args, $instance); query_posts($query_args); if (have_posts()) { while (have_posts()) { the_post(); echo '<div '; post_class(); echo '>'; gfwa_before_post_content($instance); gfwa_post_content($instance); gfwa_after_post_content($instance); echo '</div><!--end post_class()-->' . "\n\n"; $gfwa_counter++; } if (!empty($instance['show_paged'])) { genesis_posts_nav(); } gfwa_endwhile($instance); } $gfwa_counter = ''; gfwa_after_loop($instance); } // The EXTRA Posts (list) if ($instance['extra_posts'] && $instance['extra_num']) { if (!empty($instance['extra_title'])) { echo str_replace('>', ' class="additional-posts-title">', $before_title) . esc_html($instance['extra_title']) . $after_title; } $offset = intval($instance['posts_num']) + intval($instance['posts_offset']); $extra_posts_args = array_merge($term_args, array('showposts' => $instance['extra_num'], 'offset' => $offset, 'post_type' => $instance['post_type'], 'orderby' => $instance['orderby'], 'order' => $instance['order'], 'meta_key' => $instance['meta_key'], 'paged' => $page)); $extra_posts_args = apply_filters('gfwa_extra_post_args', $extra_posts_args, $instance); query_posts($extra_posts_args); $listitems = ''; if (have_posts()) { while (have_posts()) { the_post(); gfwa_list_items($instance); if ('drop_down' != $instance['extra_format']) { $listitems .= sprintf('<li><a href="%s" title="%s">%s</a></li>', get_permalink(), the_title_attribute('echo=0'), get_the_title()); } else { $listitems .= sprintf('<option onclick="javascript:window.location=\'%s\';" value="%s">%s</option>', get_permalink(), get_permalink(), get_the_title()); } } if (strlen($listitems) > 0 && 'drop_down' != $instance['extra_format']) { printf('<%s>%s</%s>', $instance['extra_format'], $listitems, $instance['extra_format']); } elseif (strlen($listitems) > 0) { printf('<select id="%s" value="%s"><option value="none">%s %s</option>%s</select>', $this->get_field_id('extra_format'), get_permalink(), __('Select', 'gfwa'), $instance['post_type'], $listitems); } gfwa_print_list_items($instance); } } if (!empty($instance['archive_link'])) { echo '<p class="more-from-category"><a href="' . $instance['archive_link'] . '" title="' . esc_html($instance['more_from_category_text']) . '">' . esc_html($instance['more_from_category_text']) . '</a></p>'; } elseif (!empty($instance['more_from_category']) && !empty($posts_term['1'])) { gfwa_category_more($instance); $term = get_term_by('slug', $posts_term['1'], $taxonomy); echo '<p class="more-from-category"><a href="' . get_term_link($posts_term['1'], $taxonomy) . '" title="' . $term->name . '">' . esc_html($instance['more_from_category_text']) . '</a></p>'; } gfwa_after_category_more($instance); echo $after_widget; wp_reset_query(); remove_filter('post_class', 'gfwa_post_class'); remove_filter('post_limits', 'gfwa_post_limit'); }
/** * The Posts Navigation/Pagination. * * @param array $instance The settings for the particular instance of the widget. */ public static function do_posts_nav($instance) { if (!empty($instance['show_paged'])) { genesis_posts_nav(); } }
function custom_genesis_posts_nav() { echo '<div class="wrap">'; genesis_posts_nav(); echo '</div>'; }
function archive_employee_loop() { $class = ''; $i = 4; if (have_posts()) { while (have_posts()) { the_post(); // starting at 4 if ($i == 4) { $class = 'first one-fourth agent-wrap'; $i = 0; } else { $class = 'one-fourth agent-wrap'; } //increase count by 1 $i++; $post_id = get_the_id(); $thumb_id = get_post_thumbnail_id(); $thumb_url = wp_get_attachment_image_src($thumb_id, 'employee-thumbnail', true); ?> <div <?php post_class($class); ?> itemscope itemtype="http://schema.org/Person"> <?php echo '<a href="' . get_permalink() . '"><img src="' . $thumb_url[0] . '" alt="' . get_the_title() . ' photo" class="attachment-employee-thumbnail wp-post-image" itemprop="image" /></a>'; ?> <div class="agent-details vcard"> <?php printf('<p><a class="fn" href="%s" itemprop="name">%s</a></p>', get_permalink(), get_the_title()); echo impa_employee_archive_details(); if (function_exists('_p2p_init') && function_exists('agentpress_listings_init') || function_exists('_p2p_init') && function_exists('wp_listings_init')) { $has_listings = impa_has_listings($post_id); if (!empty($has_listings)) { echo '<p><a class="agent-listings-link" href="' . get_permalink() . '#agent-listings">View My Listings</a></p>'; } } //echo impa_employee_social(); ?> </div><!-- .agent-details --> </div> <!-- .agent-wrap --> <?php } if (function_exists('equity')) { equity_posts_nav(); } elseif (function_exists('genesis_init')) { genesis_posts_nav(); } else { impress_agents_paging_nav(); } } else { ?> <p><?php _e('Sorry, no posts matched your criteria.'); ?> </p> <?php } }