• Skip to primary navigation
  • Skip to content
  • Skip to primary sidebar
  • Skip to user navigation

PopWP

WordPress and Genesis Tutorials

  • Get Started
  • About
  • Archive
  • Services
  • Membership
  • My Account

Excerpt Limit in a specific category archive in Genesis

Last Updated on July 27, 2018 Favorited: 0 times

TYPE 1

Default.

//* Modify the length of post excerpts
add_filter( 'excerpt_length', 'genesiskit_excerpt_length' );
function genesiskit_excerpt_length( $length ) {
	return 50; // pull first 50 words
}

TYPE 2

Target specific category

add_action( 'genesis_before_loop', 'genesiskit_change_excerpt_archives' );
	function genesiskit_change_excerpt_archives() {
	if ( ! is_category( 'uncategorized' ) ) { // enter your category slug here.
		return;
	}
	add_filter( 'excerpt_length', 'genesiskit_do_excerpt_limit' );
}
// Pull first 50 words.
function genesiskit_do_excerpt_limit() {
	return '50';
}

Multiple Categories

add_action( 'genesis_before_loop', 'genesiskit_change_excerpt_archives' );
	function genesiskit_change_excerpt_archives() {
	if ( ! is_category( 'uncategorized' ) && ! is_category( 'music' ) ) { // enter your category slug here.
		return;
	}
	add_filter( 'excerpt_length', 'genesiskit_do_excerpt_limit' );
}
// Pull first 50 words.
function genesiskit_do_excerpt_limit() {
	return '50';
}

TYPE 3

For Blog i.e Post page.

add_filter( 'excerpt_length', 'genesiskit_do_excerpt_limit_blog' );
// Set excerpt limit to 50 words.
function genesiskit_do_excerpt_limit_blog() {
	if ( ! is_home() || ! in_category( 'Uncategorized' ) ) {
		return;
	}
	return '50';
}

 

Categories: Free Content, Genesis Tutorials

Reader Interactions

Primary Sidebar

Search

WPEngine WordPress Hosting, Perfected.

Hosting You are looking for?.
Perfect solution for small business to global enterprise.

Learn more

StudioPress Genesis Theme Framework

The No.1 Theme Provider.
Creative, SEO rich Theme for all niche projects.

Learn more

Categories

  • Free Content
  • Genesis Tutorials
  • Premium Content
  • Snippets
  • What's New?
  • WordPress Tutorials

Tag Cloud

Archive Background Section blog canvas menu center logo columns conditional tags CSS CSS Grid custom Customizer custom post type Custom Post Types custom template Custom Widget effect eNews Extended Featured Image front-page Genesis Genesis Sample header right hero section Image Background js layout left menu Logo menu Navigation Menu newsletter post page related posts responsive menu search search widget Shrinking Logo site header slide in-out Stylesheet Template Utility Bar Video Background widgets WordPress

Built with Genesis Framework + WordPress by Aryan Raj

  • Contact
  • FAQ
  • Disclaimer
  • Privacy Policy
  • Copyright Policy
  • Terms of Service