• Resolved mniggemann

    (@mniggemann)


    Hi Anders,
    First of all: great theme! I especially like the way it integrates with jetpack and its portfolio options.

    There’s one question, however: I’d like to display text excerpts along the featured image thumb for the posts archive pages, as I am using them here for exhibition announcements. Is there a hook for that?

    That would be quite cool when using both normal posts and jetpack portfolio posts, there would be two different types of posts.

    Cheers from Germany,
    -martin

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Theme Author Anders Norén

    (@anlino)

    Hi @mniggemann,

    Glad you like it! There’s currently not any built-in option to display the post excerpt on archive pages, but it’s definitely something I might add in the future. For now, you can add that output yourself by using a child theme and the eksell_preview_end action hook. The following should work:

    function eksell_child_output_preview_excerpt() {
    
    	global $post;
    
    	$excerpt = get_the_excerpt( $post );
    
    	if ( $excerpt ) echo '<div class="preview-excerpt">' . wpautop( $excerpt ) . '</div>';
    
    }
    add_action( 'eksell_preview_end', 'eksell_child_output_preview_excerpt', 20 );

    You might want to add some styling to make the spacing look proper as well.

    — Anders

    Thread Starter mniggemann

    (@mniggemann)

    Hi Anders,
    Sorry for the late reply! The snippet works great actually, and for everybody attempting sth. similar, here’s the basisc styling I used:

    .preview-excerpt { padding: 1em 0; }

    For some padding, and …

    .post-type-archive-jetpack-portfolio .preview-excerpt { display: none; }

    … to show the excerpts for posts only, but not in jetpack-portfolio custom posts.

    Thanx a lot, you’re the best ??
    Just sending a donation.

    -M

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Display post excerpt in archive pages’ is closed to new replies.