Added new post type: "title and link only"

This commit is contained in:
bgcarlisle 2020-01-22 15:57:01 +01:00
parent 965c8ca804
commit d7a2b9a237
3 changed files with 10 additions and 3 deletions

View file

@ -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',

View file

@ -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();
}

View file

@ -17,7 +17,10 @@
<?php esc_html_e( 'Post-Content', 'activitypub' ); ?>
</th>
<td>
<p>
<p>
<label><input type="radio" name="activitypub_post_content_type" id="activitypub_post_content_type_title_link" value="titlelink" <?php echo \checked( 'titlelink', \get_option( 'activitypub_post_content_type', 'content' ) ); ?> /> <?php \esc_html_e( 'Title and link', 'activitypub' ); ?></label> - <span class="description"><?php \esc_html_e( 'Only the title and a link.', 'activitypub' ); ?></span>
</p>
<p>
<label><input type="radio" name="activitypub_post_content_type" id="activitypub_post_content_type_excerpt" value="excerpt" <?php echo \checked( 'excerpt', \get_option( 'activitypub_post_content_type', 'content' ) ); ?> /> <?php \esc_html_e( 'Excerpt', 'activitypub' ); ?></label> - <span class="description"><?php \esc_html_e( 'A content summary, shortened to 400 characters and without markup.', 'activitypub' ); ?></span>
</p>
<p>