Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions helpers/excerpt.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
namespace DustPress;
Comment thread
ivuorinen marked this conversation as resolved.

class Excerpt extends Helper {
public function output() {
global $post;

if ( isset( $this->params->data ) ) {
return apply_filters( 'the_excerpt', $this->params->data );
} else {
if ( isset( $this->params->id ) ) {
$post = get_post( $this->params->id );
}

ob_start();
setup_postdata( $post );
the_excerpt();
wp_reset_postdata();
return ob_get_clean();
}
Comment thread
ivuorinen marked this conversation as resolved.
Outdated
}
}

$this->add_helper( 'excerpt', new Excerpt() );