post_type ) ) { $content = apply_filters( 'affiliate_post_the_excerpt', self::transform( $content, $post ), $post ); } } return $content; } /** * Content filter, hooked on the_content, invokes the transformer. * * @param string $content * @return string filtered content */ public static function the_content( $content ) { if ( $post = get_post() ) { if ( Affiliate::post_type_enabled( $post->post_type ) ) { $content = apply_filters( 'affiliate_post_the_content', self::transform( $content, $post ), $post ); } } return $content; } /** * Content transformer. * * @param string $content * @param WP_Post $post * @return string transformed content */ public static function transform( &$content, &$post ) { require_once AFFILIATE_CORE_LIB . '/class-affiliate-content-builder.php'; $builder = new Affiliate_Content_Builder( $content ); $content = $builder->get_content(); return $content; } } add_action( 'init', array( 'Affiliate_Content', 'init' ) );