askdesign
11/28/2015 - 11:21 PM

How to show a single post on Blog and only titles on Category archives in Genesis

How to show a single post on Blog and only titles on Category archives in Genesis

www.billerickson.net/customize-the-wordpress-query/

https://sridharkatakam.com/sublime-text-snippets-for-genesis/

https://sridharkatakam.com/how-to-show-a-single-post-on-blog-and-only-titles-on-category-archives-in-genesis/
.category .content .entry {
	margin-bottom: 0;
	padding-bottom: 0;
	padding-top: 20px;
}

.category .content .entry-title {
	font-size: 24px;
}

.category .articles {
	padding-top: 20px;
	padding-bottom: 40px;
	background-color: #fff;
}
// Displaying only titles for Posts on Category Archives
// category.php:

<?php
remove_action( 'genesis_entry_header', 'genesis_do_post_format_image', 4 );
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
remove_action( 'genesis_entry_content', 'genesis_do_post_content_nav', 12 );
remove_action( 'genesis_entry_content', 'genesis_do_post_permalink', 14 );
remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 );
remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 );
remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
remove_action( 'genesis_after_entry', 'genesis_do_author_box_single', 8 );
remove_action( 'genesis_after_entry', 'genesis_get_comments_template' );
add_action( 'loop_start', 'sk_opening_articles_tag' );
function sk_opening_articles_tag() {
	echo '<div class="articles">';
}
add_action( 'loop_end', 'sk_closing_articles_tag' );
function sk_closing_articles_tag() {
	echo '</div>';
}
genesis();
// Showing just one entry on the Posts page
add_action( 'pre_get_posts', 'sk_change_blog_posts_per_page' );
/**
 * Change Posts Per Page for Posts page
 *
 * @author Bill Erickson
 * @link http://www.billerickson.net/customize-the-wordpress-query/
 * @param object $query data
 *
 */
function sk_change_blog_posts_per_page( $query ) {

	if( $query->is_main_query() && !is_admin() && is_home() ) {
		$query->set( 'posts_per_page', '1' );
	}

}