Make Post-Template filterable (#597)
* make template filterable prepare #596 also #519 * updated changelog
This commit is contained in:
parent
77c508059b
commit
9f8bad3e8d
3 changed files with 18 additions and 11 deletions
|
@ -110,6 +110,7 @@ Project maintained on GitHub at [automattic/wordpress-activitypub](https://githu
|
||||||
* Removed: Deprecated Classes
|
* Removed: Deprecated Classes
|
||||||
* Fixed: Normalize attributes that can have mixed value types
|
* Fixed: Normalize attributes that can have mixed value types
|
||||||
* Added: URL support for WebFinger
|
* Added: URL support for WebFinger
|
||||||
|
* Added: Make Post-Template filterable
|
||||||
|
|
||||||
### 1.3.0 ###
|
### 1.3.0 ###
|
||||||
|
|
||||||
|
|
|
@ -559,19 +559,24 @@ class Post {
|
||||||
* @return string The Template.
|
* @return string The Template.
|
||||||
*/
|
*/
|
||||||
protected function get_post_content_template() {
|
protected function get_post_content_template() {
|
||||||
if ( 'excerpt' === \get_option( 'activitypub_post_content_type', 'content' ) ) {
|
$type = \get_option( 'activitypub_post_content_type', 'content' );
|
||||||
return "[ap_excerpt]\n\n[ap_permalink type=\"html\"]";
|
|
||||||
|
switch ( $type ) {
|
||||||
|
case 'excerpt':
|
||||||
|
$template = "[ap_excerpt]\n\n[ap_permalink type=\"html\"]";
|
||||||
|
break;
|
||||||
|
case 'title':
|
||||||
|
$template = "[ap_title]\n\n[ap_permalink type=\"html\"]";
|
||||||
|
break;
|
||||||
|
case 'content':
|
||||||
|
$template = "[ap_content]\n\n[ap_permalink type=\"html\"]\n\n[ap_hashtags]";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$template = \get_option( 'activitypub_custom_post_content', ACTIVITYPUB_CUSTOM_POST_CONTENT );
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( 'title' === \get_option( 'activitypub_post_content_type', 'content' ) ) {
|
return apply_filters( 'activitypub_object_content_template', $template, $this->wp_post );
|
||||||
return "[ap_title]\n\n[ap_permalink type=\"html\"]";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( 'content' === \get_option( 'activitypub_post_content_type', 'content' ) ) {
|
|
||||||
return "[ap_content]\n\n[ap_permalink type=\"html\"]\n\n[ap_hashtags]";
|
|
||||||
}
|
|
||||||
|
|
||||||
return \get_option( 'activitypub_custom_post_content', ACTIVITYPUB_CUSTOM_POST_CONTENT );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -110,6 +110,7 @@ Project maintained on GitHub at [automattic/wordpress-activitypub](https://githu
|
||||||
* Removed: Deprecated Classes
|
* Removed: Deprecated Classes
|
||||||
* Fixed: Normalize attributes that can have mixed value types
|
* Fixed: Normalize attributes that can have mixed value types
|
||||||
* Added: URL support for WebFinger
|
* Added: URL support for WebFinger
|
||||||
|
* Added: Make Post-Template filterable
|
||||||
|
|
||||||
= 1.3.0 =
|
= 1.3.0 =
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue