Portfolio excerpts

Viewing 3 posts - 1 through 3 (of 3 total)
  • #20846
    m01
    Participant

    Hi there,
    It’s great to see that the Enlightenment theme supports the jetpack portfolio custom content type already!
    However, I’d like to show an excerpt of each “project” on the project archive overview page (similarly to what’s possible with blog posts), rather than just the title. To do this, I added excerpt support for portfolio projects by adding the following to functions.php (see e.g. this and this):

    function jetpackme_portfolio_excerpts() {
    	add_post_type_support( 'jetpack-portfolio', 'excerpt' );
    }
    add_action( 'init', 'jetpackme_portfolio_excerpts' );

    Now however I can’t figure out how to actually display the excerpts on the portfolio project page. Under Appearance->Theme options->Templates->Projects archive, I’ve added “post excerpt” and “post content” to the “hooked functions” of the “Entry content”, but that doesn’t seem to have any effect.

    Is there any way to achieve this?

    • This topic was modified 8 years, 12 months ago by m01. Reason: added source
    #20923
    Daniel Tara
    Keymaster

    This code should display excerpts below the post titles for projects:

    add_action( 'enlightenment_before_entry', 'enlightenment_project_excerpts', 6 );
    
    function enlightenment_project_excerpts() {
    	if( class_exists( 'Jetpack' ) && in_array( 'custom-content-types', Jetpack::get_active_modules() ) ) {
    		add_action( 'enlightenment_entry_content', 'the_excerpt' );
    	}
    }
    #21095
    m01
    Participant

    Hi Daniel,
    Thank you for your help! That brought me onto the right track. I turned out I needed to change the following bit of code in default-hooks.php:

    
    function enlightenment_project_teaser_actions() {
    	if( current_theme_supports( 'jetpack-portfolio' ) && class_exists( 'Jetpack' ) && in_array( 'custom-content-types', Jetpack::get_active_modules() ) ) {
    		if( ( is_post_type_archive( 'jetpack-portfolio' ) || is_tax( 'jetpack-portfolio-type' ) || is_tax( 'jetpack-portfolio-tag' ) ) && current_theme_supports( 'enlightenment-grid-loop' ) && ! enlightenment_is_lead_post() ) {
    			enightenment_clear_entry_hooks();
    			add_action( 'enlightenment_entry_header', 'the_post_thumbnail' );
    			add_action( 'enlightenment_entry_header', 'the_title', 10, 2 );
    			add_action( 'enlightenment_entry_content', 'the_excerpt' );/// <<< new
    		}
    	}
    }
    

    I suspect adding the hook like you suggested doesn’t work because of the enlightenment_clear_entry_hooks() call in that function, right?

Viewing 3 posts - 1 through 3 (of 3 total)

Tagged: 

You must be logged in to reply to this topic.