/** * Do The Loop via the type configured * * @since 1.0.0 * * @uses genesis_custom_loop() * @uses genesis_grid_loop() * @uses genesis_standard_loop() * * @return null */ public function do_loop() { if ('genesis_custom_loop' == $this->query_config['function']) { genesis_custom_loop($this->query_config['query_args']); } elseif ('genesis_grid_loop' == $this->query_config['function']) { genesis_grid_loop($this->query_config['query_args']); } else { genesis_standard_loop(); } }
/** * Outputs a custom loop * * @global mixed $paged current page number if paginated * @return void */ function recent_do_loop() { global $paged; // accepts any wp_query args $args = array('post_type' => 'post', 'paged' => $paged, 'posts_per_page' => 10); genesis_custom_loop($args); }
/** * Outputs a custom loop * * @global mixed $paged current page number if paginated * @return void */ function homepage_do_loop() { global $paged; // accepts any wp_query args $args = array('post_type' => 'post', 'paged' => $paged, 'posts_per_page' => 12); remove_action('genesis_entry_content', 'genesis_do_post_image', 8); genesis_custom_loop($args); }
/** * Outputs a custom loop * * @global mixed $paged current page number if paginated * @return void */ function sk_masonry_loop() { $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; //* Easter Egg $query_args = wp_parse_args(genesis_get_custom_field('query_args'), array('cat' => $include, 'category__not_in' => $exclude, 'showposts' => genesis_get_option('blog_cat_num'), 'paged' => $paged)); genesis_custom_loop($query_args); }
function psu_do_custom_loop_lopande() { global $query_args; // grab the current wp_query() args global $cat_id; // http://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters $args = array('cat' => $cat_id, 'meta_query' => array(array('key' => 'lopande', 'value' => 'ja', 'compare' => '=', 'type' => 'CHAR')), 'orderby' => 'menu_order', 'order' => 'ASC', 'posts_per_page' => '999'); printf('<h2 class="category-title category-subtitle">%s</h2>', __('Ongoing grants', 'magazine')); genesis_custom_loop(wp_parse_args($query_args, $args)); }
function portfolio_loop() { $paged = get_query_var('paged') ? get_query_var('paged') : 1; $include = genesis_get_option('crystal_portfolio_cat'); $exclude = genesis_get_option('crystal_portfolio_cat_exclude') ? explode(',', str_replace(' ', '', genesis_get_option('crystal_portfolio_cat_exclude'))) : ''; $cf = genesis_get_custom_field('query_args'); // Easter Egg $args = array('cat' => $include, 'category__not_in' => $exclude, 'showposts' => genesis_get_option('crystal_portfolio_cat_num'), 'paged' => $paged); $query_args = wp_parse_args($cf, $args); genesis_custom_loop($query_args); }
function psu_do_custom_loop() { global $paged; // current paginated page global $query_args; // grab the current wp_query() args global $cat_id; // http://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters // $now = new DateTime(current_time('mysql')); $args = array('cat' => $cat_id, 'meta_query' => array(array('key' => 'startdate', 'value' => strtotime('yesterday 10pm') * 1000, 'compare' => '>=', 'type' => 'NUMERIC')), 'orderby' => 'meta_value_num', 'order' => 'ASC', 'paged' => $paged, 'posts_per_page' => '12'); genesis_custom_loop(wp_parse_args($query_args, $args)); }
/** * Attach a loop to the `genesis_loop` output hook so we can get some front-end output. * * @since 1.1.0 */ function genesis_do_loop() { if (is_page_template('page_blog.php')) { $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; // Easter Egg. $query_args = wp_parse_args(genesis_get_custom_field('query_args'), array('cat' => $include, 'category__not_in' => $exclude, 'showposts' => genesis_get_option('blog_cat_num'), 'paged' => $paged)); genesis_custom_loop($query_args); } else { genesis_standard_loop(); } }
/** * Genesis Page Templates Custom Loop. * * @since 1.0.1 */ function genesis_page_templates_custom_loop() { $gcl_post_type = esc_attr(genesis_get_custom_field('_gcl_post_type')); $gcl_taxonomy = esc_attr(genesis_get_custom_field('_gcl_taxonomy')); $gcl_tax_term = esc_attr(genesis_get_custom_field('_gcl_tax_term')); $gcl_posts_per_page = esc_attr(genesis_get_custom_field('_gcl_posts_per_page')); $gcl_order_by = esc_attr(genesis_get_custom_field('_gcl_order_by')); $gcl_order = esc_attr(genesis_get_custom_field('_gcl_order')); $paged = get_query_var('paged') ? get_query_var('paged') : 1; $query_args = wp_parse_args(array('post_type' => $gcl_post_type, 'posts_per_page' => $gcl_posts_per_page, 'orderby' => $gcl_order_by, 'order' => $gcl_order, 'paged' => $paged)); if (!empty($gcl_tax_term)) { $terms = empty($gcl_tax_term) ? get_terms($gcl_taxonomy) : $gcl_tax_term; $args['tax_query'] = array(array('taxonomy' => $gcl_taxonomy, 'field' => 'slug', 'terms' => $terms)); } genesis_custom_loop($query_args); }
function cwp_genesis_easy_queries_do_custom_loop() { //get slug of current page $page = get_query_var('pagename'); //Correct for the fact that Easy Queries have underscores, not dashes $slug = str_replace('-', '_', $page); //get class instance $class = \calderawp\caeq\core::get_instance(); //find arguments for an Easy Query with same slug as page $args = $class->build_query_args($slug); //check if we found a matching Easy Query if (!$args) { //Nope, so do normal loop. genesis_standard_loop(); } else { //Found an Easy Query, use its arguments genesis_custom_loop($args); } }
/** * Genesis Page Templates Custom Loop. * * @since 1.0.1 */ function genesis_page_templates_custom_loop() { global $paged, $query_args; $gcl_post_type = esc_attr(genesis_get_custom_field('_gcl_post_type')); $gcl_taxonomy = esc_attr(genesis_get_custom_field('_gcl_taxonomy')); $gcl_tax_term = esc_attr(genesis_get_custom_field('_gcl_tax_term')); $gcl_posts_per_page = esc_attr(genesis_get_custom_field('_gcl_posts_per_page')); $gcl_order_by = esc_attr(genesis_get_custom_field('_gcl_order_by')); $gcl_order = esc_attr(genesis_get_custom_field('_gcl_order')); $args = array('post_type' => $gcl_post_type, 'posts_per_page' => $gcl_posts_per_page, 'orderby' => $gcl_order_by, 'order' => $gcl_order, 'paged' => $paged); if (!empty($gcl_taxonomy) && empty($gcl_tax_term)) { $all_tax_terms = array(); $tax_terms = get_terms($gcl_taxonomy); foreach ($tax_terms as $tax_term) { $all_tax_terms[] = $tax_term->slug; } $args['tax_query'] = array(array('taxonomy' => $gcl_taxonomy, 'field' => 'slug', 'terms' => $all_tax_terms)); } elseif (!empty($gcl_taxonomy) && !empty($gcl_tax_term)) { $args['tax_query'] = array(array('taxonomy' => $gcl_taxonomy, 'field' => 'slug', 'terms' => $gcl_tax_term)); } genesis_custom_loop(wp_parse_args($query_args, $args)); }
/** * Display latest posts instead of static page. * * @since 1.0.0 */ function utility_pro_front_loop() { global $query_args; genesis_custom_loop(wp_parse_args($query_args, array('post_type' => 'post', 'paged' => get_query_var('page')))); }
/** * The grid loop - a specific implementation of a custom loop. * * Outputs markup compatible with a Feature + Grid style layout. * All normal loop hooks present, except for genesis_post_content. * * The arguments can be filtered by the genesis_grid_loop_args filter. * * @since 1.5.0 * * @uses g_ent() Pass entities through filter * @uses genesis_custom_loop() Do custom loop * @uses genesis_standard_loop() Do standard loop * @uses genesis_reset_loop() Restores all default post loop output by rehooking all default functions * * @global array $_genesis_loop_args Associative array for grid loop configuration * @global string $query_string Query string * @param array $args Associative array for grid loop configuration * @return null Returns early if posts_per_page is fewer than features */ function genesis_grid_loop($args = array()) { /** Global vars */ global $_genesis_loop_args, $query_string; /** Parse args */ $args = apply_filters('genesis_grid_loop_args', wp_parse_args($args, array('loop' => 'standard', 'features' => 2, 'features_on_all' => false, 'feature_image_size' => 0, 'feature_image_class' => 'alignleft post-image', 'feature_content_limit' => 0, 'grid_image_size' => 'thumbnail', 'grid_image_class' => 'alignleft post-image', 'grid_content_limit' => 0, 'more' => g_ent(__('Read more…', 'genesis')), 'posts_per_page' => get_option('posts_per_page'), 'paged' => get_query_var('paged') ? get_query_var('paged') : 1))); /** Error handler */ if ($args['posts_per_page'] < $args['features']) { trigger_error(sprintf(__('You are using invalid arguments with the %s function.', 'genesis'), __FUNCTION__)); return; } /** Potentially remove features on page 2+ */ if (!$args['features_on_all'] && $args['paged'] > 1) { $args['features'] = 0; } /** Set global loop args */ $_genesis_loop_args = wp_parse_args($args, $query_string); /** Remove some unnecessary stuff from the grid loop */ remove_action('genesis_before_post_title', 'genesis_do_post_format_image'); remove_action('genesis_post_content', 'genesis_do_post_image'); remove_action('genesis_post_content', 'genesis_do_post_content'); /** Custom loop output */ add_filter('post_class', 'genesis_grid_loop_post_class'); add_action('genesis_post_content', 'genesis_grid_loop_content'); /** Set query args */ $args = $_genesis_loop_args; if (isset($args['features']) && is_numeric($args['features'])) { unset($args['features']); } /** The loop */ if ('custom' == $_genesis_loop_args['loop']) { genesis_custom_loop($args); } else { query_posts($args); genesis_standard_loop(); } /** Reset loops */ genesis_reset_loops(); remove_filter('post_class', 'genesis_grid_loop_post_class'); remove_action('genesis_post_content', 'genesis_grid_loop_content'); }
/** * Attach a loop to the `genesis_loop` output hook so we can get some front-end output. * * @since 1.1.0 * * @uses genesis_get_option() Get theme setting value. * @uses genesis_get_custom_field() Get custom field value. * @uses genesis_custom_loop() Do custom loop. * @uses genesis_standard_loop() Do standard loop. */ function und_do_loop() { if (current_user_can('editor') || current_user_can('administrator')) { kernredaktion_widget(); } if (is_page_template('page_login.php')) { if (is_user_logged_in()) { print '<a href="https://webmail.cyon.ch/"><div class="cell cell-intern" style="background: #3EA4D7;"><svg class="icon icon-email" viewBox="0 0 48 32"><use xlink:href="#icon-email"></use></svg></div></a> <a href="http://www.generationentandem.ch/interner-bereich/"><div class="cell cell-intern" style="background:' . get_theme_mod('theme_color') . ';"><svg class="icon icon-internerbereich" viewBox="0 0 48 32"><use xlink:href="#icon-internerbereich"></use></svg></div></a>'; genesis_standard_loop(); } else { print "<article class='entry page'><h1>Login</h1>"; wp_login_form(); print "</article>"; } } else { if (is_page_template('page_intern.php')) { if (is_user_logged_in()) { $content_width = 1000; intern_widget(); genesis_standard_loop(); } else { print "<article class='entry page'><h1>Login</h1>"; wp_login_form(); print "</article>"; } } else { if (is_category(1413)) { //ontour_widget(); ontour_map(); $include = 1413; $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; //* Easter Egg $query_args = wp_parse_args(genesis_get_custom_field('query_args'), array('cat' => $include, 'category__not_in' => $exclude, 'showposts' => genesis_get_option('blog_cat_num'), 'paged' => $paged)); genesis_custom_loop($query_args); } else { if (in_category(1413) && is_single() || is_child(4976) && is_page()) { //ontour_widget(); genesis_standard_loop(); } else { //ontour_widget(); genesis_standard_loop(); } } } } }
/** * Yet another custom loop function. * Outputs markup compatible with a Feature + Grid style layout. * All normal loop hooks present, except for genesis_post_content. * * @since 1.5 */ function genesis_grid_loop($args = array()) { /** Global vars **/ global $_genesis_loop_args; /** Parse args **/ $args = apply_filters('genesis_grid_loop_args', wp_parse_args($args, array('loop' => 'standard', 'features' => 2, 'feature_image_size' => 0, 'feature_image_class' => 'alignleft post-image', 'feature_content_limit' => 0, 'grid_image_size' => 'thumbnail', 'grid_image_class' => 'alignleft post-image', 'grid_content_limit' => 0, 'more' => __('[Read more...]', 'genesis'), 'posts_per_page' => get_option('posts_per_page'), 'paged' => get_query_var('paged') ? get_query_var('paged') : 1))); /** Error handler **/ if ($args['posts_per_page'] < $args['features']) { trigger_error(sprintf(__('You are using invalid arguments with the %s function.', 'genesis'), __FUNCTION__)); return; } /** Don't show features on page 2+ **/ if ($args['paged'] > 1) { $args['features'] = 0; } /** Set global loop args **/ $_genesis_loop_args = $args; /** Remove some unnecessary stuff from the grid loop **/ remove_action('genesis_before_post_title', 'genesis_do_post_format_image'); remove_action('genesis_post_content', 'genesis_do_post_image'); remove_action('genesis_post_content', 'genesis_do_post_content'); /** Custom loop output **/ add_filter('post_class', 'genesis_grid_loop_post_class'); add_action('genesis_post_content', 'genesis_grid_loop_content'); /** The loop **/ if ($args['loop'] == 'custom') { genesis_custom_loop($args); } else { query_posts($args); genesis_standard_loop(); } /** Reset loops **/ genesis_reset_loops(); remove_filter('post_class', 'genesis_grid_loop_post_class'); remove_action('genesis_post_content', 'genesis_grid_loop_content'); }