diff --git a/includes/class-activitypub.php b/includes/class-activitypub.php index 65afe74..8b3a54e 100644 --- a/includes/class-activitypub.php +++ b/includes/class-activitypub.php @@ -16,8 +16,12 @@ class Activitypub { \add_action( 'init', array( '\Activitypub\Activitypub', 'add_rewrite_endpoint' ) ); \add_filter( 'pre_get_avatar_data', array( '\Activitypub\Activitypub', 'pre_get_avatar_data' ), 11, 2 ); - \add_post_type_support( 'post', 'activitypub' ); - \add_post_type_support( 'page', 'activitypub' ); + // Add support for ActivityPub to custom post types + $post_types = \get_option( 'activitypub_support_post_types', array( 'post', 'page' ) ) ? \get_option( 'activitypub_support_post_types', array( 'post', 'page' ) ) : array(); + + foreach ( $post_types as $post_type ) { + \add_post_type_support( $post_type, 'activitypub' ); + } \add_action( 'transition_post_status', array( '\Activitypub\Activitypub', 'schedule_post_activity' ), 10, 3 ); } @@ -89,7 +93,7 @@ class Activitypub { } /** - * Marks the post as "no webmentions sent yet" + * Schedule Activities * * @param int $post_id */ diff --git a/includes/class-admin.php b/includes/class-admin.php index a4523ae..51513cb 100644 --- a/includes/class-admin.php +++ b/includes/class-admin.php @@ -98,6 +98,14 @@ class Admin { 'default' => 0, ) ); + \register_setting( + 'activitypub', 'activitypub_support_post_types', array( + 'type' => 'string', + 'description' => \esc_html__( 'Enable ActivityPub support for post types', 'activitypub' ), + 'show_in_rest' => true, + 'default' => array( 'post', 'pages' ), + ) + ); } public static function add_settings_help_tab() { diff --git a/templates/settings.php b/templates/settings.php index 93f1d75..cfe3b4a 100644 --- a/templates/settings.php +++ b/templates/settings.php @@ -50,6 +50,25 @@

+ + + +
+ + + true ), 'objects' ); ?> + + +
+ +