From d7a2b9a23712c1c227f4d19976e8aa94037d847d Mon Sep 17 00:00:00 2001 From: bgcarlisle Date: Wed, 22 Jan 2020 15:57:01 +0100 Subject: [PATCH 1/2] Added new post type: "title and link only" --- includes/class-admin.php | 4 ++-- includes/model/class-post.php | 4 ++++ templates/settings.php | 5 ++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/includes/class-admin.php b/includes/class-admin.php index fbdf85d..658c861 100644 --- a/includes/class-admin.php +++ b/includes/class-admin.php @@ -56,10 +56,10 @@ class Admin { \register_setting( 'activitypub', 'activitypub_post_content_type', array( 'type' => 'string', - 'description' => \__( 'Use summary or full content', 'activitypub' ), + 'description' => \__( 'Use title and link, summary or full content', 'activitypub' ), 'show_in_rest' => array( 'schema' => array( - 'enum' => array( 'excerpt', 'content' ), + 'enum' => array( 'titlelink', 'excerpt', 'content' ), ), ), 'default' => 'content', diff --git a/includes/model/class-post.php b/includes/model/class-post.php index f27e3d1..e196ae5 100644 --- a/includes/model/class-post.php +++ b/includes/model/class-post.php @@ -204,6 +204,10 @@ class Post { return $this->get_the_post_summary(); } + if ( 'titlelink' === \get_option( 'activitypub_post_content_type', 'content' ) ) { + return $this->get_the_title(); + } + return $this->get_the_post_content(); } diff --git a/templates/settings.php b/templates/settings.php index e4e9532..3e34051 100644 --- a/templates/settings.php +++ b/templates/settings.php @@ -17,7 +17,10 @@ -

+

+ - +

+

-

From 9b894a7d1404e0b79c3473c88d21635c68986c27 Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Tue, 11 Feb 2020 10:03:59 +0100 Subject: [PATCH 2/2] use `title` instead of `titlelink` --- includes/class-admin.php | 2 +- includes/model/class-post.php | 2 +- templates/settings.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/class-admin.php b/includes/class-admin.php index 658c861..866f873 100644 --- a/includes/class-admin.php +++ b/includes/class-admin.php @@ -59,7 +59,7 @@ class Admin { 'description' => \__( 'Use title and link, summary or full content', 'activitypub' ), 'show_in_rest' => array( 'schema' => array( - 'enum' => array( 'titlelink', 'excerpt', 'content' ), + 'enum' => array( 'title', 'excerpt', 'content' ), ), ), 'default' => 'content', diff --git a/includes/model/class-post.php b/includes/model/class-post.php index e196ae5..738ab17 100644 --- a/includes/model/class-post.php +++ b/includes/model/class-post.php @@ -204,7 +204,7 @@ class Post { return $this->get_the_post_summary(); } - if ( 'titlelink' === \get_option( 'activitypub_post_content_type', 'content' ) ) { + if ( 'title' === \get_option( 'activitypub_post_content_type', 'content' ) ) { return $this->get_the_title(); } diff --git a/templates/settings.php b/templates/settings.php index 3e34051..3949e4f 100644 --- a/templates/settings.php +++ b/templates/settings.php @@ -18,7 +18,7 @@

- - + -

-