123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- <?php
- /**
- * This file adds the blog page template to the Captivating theme.
- *
- * @package Captivating
- * @link http://restored316designs.com/themes
- * @author Lauren Gaige // Restored 316 LLC
- * @copyright Copyright (c) 2015, Restored 316 LLC, Released 08/09/2017
- * @license GPL-2.0+
- */
- /*
- Template Name: Custom Blog
- */
- /** Replace the standard loop with our custom loop */
- remove_action( 'genesis_loop', 'genesis_do_loop' );
- add_action( 'genesis_loop', 'captivating_do_custom_loop' );
-
- function captivating_do_custom_loop() {
-
- global $paged; // current paginated page
- global $query_args; // grab the current wp_query() args
- $args = array(
- 'paged' => $paged, // respect pagination
- );
-
- genesis_custom_loop( wp_parse_args($query_args, $args) );
-
- }
- //* Add archive body class to the head
- add_filter( 'body_class', 'captivating_add_archive_body_class' );
- function captivating_add_archive_body_class( $classes ) {
- $classes[] = 'captivating-custom-blog';
- return $classes;
- }
- //* Adds Flexible Featured Content Above Content on Blog Page Template
- add_action( 'genesis_after_header', 'captivating_above_blog_content' );
- function captivating_above_blog_content() {
-
- genesis_widget_area( 'above-blog-content', array(
- 'before' => '<div id="above-blog-content" class="above-blog-content"><div class="wrap">',
- 'after' => '</div></div>',
- ) );
- }
- //* Remove Featured image (if set in Theme Settings)
- add_filter( 'genesis_pre_get_option_content_archive_thumbnail', 'captivating_no_post_image' );
- function captivating_no_post_image() {
- return '0';
- }
- //* Show Excerpts regardless of Theme Settings
- add_filter( 'genesis_pre_get_option_content_archive', 'captivating_show_excerpts' );
- function captivating_show_excerpts() {
- return 'excerpts';
- }
- //* Modify the length of post excerpts
- add_filter( 'excerpt_length', 'captivating_excerpt_length' );
- function captivating_excerpt_length( $length ) {
- return 60; // pull first 50 words
- }
- //* Modify the Excerpt read more link
- add_filter('excerpt_more', 'captivating_new_excerpt_more');
- function captivating_new_excerpt_more($more) {
- return '... <br><a class="more-link" href="' . get_permalink() . '">Read More</a>';
- }
- //* Make sure content limit (if set in Theme Settings) doesn't apply
- add_filter( 'genesis_pre_get_option_content_archive_limit', 'captivating_no_content_limit' );
- function captivating_no_content_limit() {
- return '0';
- }
- //* Display centered wide featured image for First Post and left aligned thumbnail for the next five
- add_action( 'genesis_entry_header', 'captivating_show_featured_image', 8 );
- function captivating_show_featured_image() {
- if ( ! has_post_thumbnail() ) {
- return;
- }
- global $wp_query;
- if( ( $wp_query->current_post <= 0 ) ) {
- $image_args = array(
- 'size' => 'horizontal-entry-image',
- 'attr' => array(
- 'class' => 'aligncenter',
- ),
- );
-
- } else {
- $image_args = array(
- 'size' => 'vertical-entry-image',
- 'attr' => array(
- 'class' => 'alignleft',
- ),
- );
- }
- $image = genesis_get_image( $image_args );
- echo '<div class="home-featured-image"><a href="' . get_permalink() . '">' . $image .'</a></div>';
-
- }
- //* Remove entry meta
- remove_action( 'genesis_entry_header', 'genesis_post_info', 9 );
- //* Run the default Genesis loop
- genesis();
|