diff --git a/includes/class-shortcodes.php b/includes/class-shortcodes.php index 7091106..093adde 100644 --- a/includes/class-shortcodes.php +++ b/includes/class-shortcodes.php @@ -2,8 +2,18 @@ namespace Activitypub; class Shortcodes { + /** + * The post object we're currently working on + * + * @var WP_Post $post A WordPress Post Object + */ private $post; + /** + * Class constructor, registering WordPress then shortcodes + * + * @param WP_Post $post A WordPress Post Object + */ public function __construct( $post = null ) { if( $post == null ) { $post = \get_post(); @@ -16,7 +26,7 @@ class Shortcodes { } foreach( get_class_methods( $this ) as $shortcode ) { - if( $shortcode != 'init' && strpos( $shortcode, '__' ) !== 0 ) { + if( strpos( $shortcode, '__' ) !== 0 ) { add_shortcode( 'ap_' . $shortcode, array( $this, $shortcode ) ); } } diff --git a/includes/model/class-post.php b/includes/model/class-post.php index d528be6..bf9c65c 100644 --- a/includes/model/class-post.php +++ b/includes/model/class-post.php @@ -238,6 +238,7 @@ class Post { $post = $this->post; $content = $this->get_post_content_template(); + // Register the shortcodes. $shortcodes = new \Activitypub\Shortcodes( $post ); // Fill in the shortcodes.