-
-
Save srikat/be2c6c06ccec13779977 to your computer and use it in GitHub Desktop.
Full content for the first post in Genesis. https://sridharkatakam.com/how-to-display-full-content-for-the-first-post-in-genesis/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'genesis_before_loop', 'sk_custom_content_display' ); | |
/** | |
* Show full content for the latest first post on content archives | |
* | |
* @author Sridhar Katakam | |
* @link http://sridharkatakam.com/ | |
*/ | |
function sk_custom_content_display() { | |
// if this is a singular entry or paginated content archive page, exit | |
if ( is_singular() || is_paged() ) { | |
return; | |
} | |
add_filter( 'genesis_pre_get_option_content_archive_thumbnail', 'sk_return_zero' ); | |
add_filter( 'genesis_pre_get_option_content_archive', 'sk_return_full' ); | |
add_filter( 'genesis_pre_get_option_content_archive_limit', 'sk_return_zero' ); | |
} | |
function sk_return_zero() { | |
global $wp_query; | |
if ( ( $wp_query->current_post == 0 ) ) { | |
return '0'; | |
} | |
} | |
function sk_return_full() { | |
global $wp_query; | |
if ( ( $wp_query->current_post == 0 ) ) { | |
return 'full'; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'genesis_before_loop', 'sk_custom_content_display' ); | |
/** | |
* Show full content for the latest first post on content archives | |
* | |
* @author Sridhar Katakam | |
* @link http://sridharkatakam.com/ | |
*/ | |
function sk_custom_content_display() { | |
// if this is a singular entry or paginated content archive page, exit | |
if ( is_singular() || is_paged() ) { | |
return; | |
} | |
add_filter( 'genesis_pre_get_option_content_archive_thumbnail', 'sk_return_zero' ); | |
add_filter( 'genesis_pre_get_option_content_archive', 'sk_return_full' ); | |
add_filter( 'genesis_pre_get_option_content_archive_limit', 'sk_return_zero' ); | |
add_action( 'genesis_after_entry', 'sk_comments' ); | |
} | |
function sk_return_zero() { | |
global $wp_query; | |
if ( ( $wp_query->current_post == 0 ) ) { | |
return '0'; | |
} | |
} | |
function sk_return_full() { | |
global $wp_query; | |
if ( ( $wp_query->current_post == 0 ) ) { | |
return 'full'; | |
} | |
} | |
function sk_comments() { | |
global $wp_query; | |
if ( ( $wp_query->current_post != 0 ) ) { | |
return; | |
} | |
// Comments List and Comment Form | |
// https://twitter.com/rob_neu/status/616842862861271040 | |
global $withcomments; | |
$temp = $withcomments; | |
$withcomments = true; | |
comments_template( '', true ); | |
$withcomments = $temp; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment