• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Using custom excerpts

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Using custom excerpts

This topic is: resolved
  • This topic has 3 replies, 3 voices, and was last updated 9 years, 1 month ago by Genesis Developer.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • August 4, 2014 at 6:31 pm #117067
    creative5designs
    Member

    I have a site that I'm using the standard Genesis loop on, with the content limit showing, which is fine, but sometimes I'd rather show a manual excerpt instead of the content limit. Is there a way to have Genesis show the manual excerpt if it exists, otherwise show the content limit? (I'm sure this is probably an easy fix, I just can't seem to find it/make it work!)

    Thanks in advance.

    August 4, 2014 at 7:02 pm #117080
    ᴅᴀᴠɪᴅ
    Member

    It's in the theme settings.

    So Genesis > Theme Settings > Content Archives, select Display post excerpts.

    Sorry if i misunderstood the question, but I think that is what you mean


    I love helping creative entrepreneurs build epic things with WP & Genesis.

    Follow on Twitter

    August 4, 2014 at 7:06 pm #117083
    creative5designs
    Member

    Thanks for responding David - I think I may not have worded my question very well.

    I have the setting set to show the content limit, which is what I want most of the time. However, on a few posts, I would like to craft manual excerpts instead. So by default, it will show the content limit, but if a manual excerpt exists on a post it would show that.

    I'm thinking it would be a php if/else statement in the functions to set this, I'm just not good enough with coding yet to know exactly how to craft the function.

    August 4, 2014 at 11:06 pm #117120
    Genesis Developer
    Member

    Yes. There need a bit of PHP code and a custom meta variable. You'll assign the "manual_excerpt" meta key for manual excerpt post only. You can achieve it this way:

    Step 1. Meta key = manual_excerpt
    Step 2. Meta value = yes
    Step 3. Rewrite the genesis_do_post_content function. Write the code in your functions.php file ( I did not test the code. So before you'll keep a backup of your functions.php file)

    //removing the default genesis_do_post_content function
    remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
    //re-creating the new one "genesis_do_post_content_new"
    add_action( 'genesis_entry_content', 'genesis_do_post_content_new' );
    function genesis_do_post_content_new(){
         global $post;
    
    	if ( is_singular() ) {
    		the_content();
    
    		if ( is_single() && 'open' === get_option( 'default_ping_status' ) && post_type_supports( $post->post_type, 'trackbacks' ) ) {
    			echo '<!--';
    			trackback_rdf();
    			echo '-->' . "\n";
    		}
    
    		if ( is_page() && apply_filters( 'genesis_edit_post_link', true ) )
    			edit_post_link( __( '(Edit)', 'genesis' ), '', '' );
    	}
    	elseif ( "yes" == get_post_meta($post->ID, 'manual_excerpt', true) || 'excerpts' === genesis_get_option( 'content_archive' ) ) {
    		the_excerpt();
    	}
    	else {
    		if ( genesis_get_option( 'content_archive_limit' ) )
    			the_content_limit( (int) genesis_get_option( 'content_archive_limit' ), __( '[Read more...]', 'genesis' ) );
    		else
    			the_content( __( '[Read more...]', 'genesis' ) );
    	}
    }

    Good Luck!


    Download Genesis Featured Posts Combo Widget | Simple Grid Layouts Plugin for Posts, CPTs and terms
    You can request new tips/help.

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble