Update safe title helper parameters
Added the $context parameter and $args, which now also covers $no_filters which hopefully nobody has used yet lol
This commit is contained in:
parent
cd1585fe20
commit
fc7fc2ac2e
@ -738,12 +738,14 @@ Filters the RSS link returned by the `fictioneer_get_rss_link( $post_type, $post
|
||||
|
||||
---
|
||||
|
||||
### `apply_filters( 'fictioneer_filter_safe_title', $title, $post_id )`
|
||||
### `apply_filters( 'fictioneer_filter_safe_title', $title, $post_id, $context, $args )`
|
||||
Filters the string returned by the `fictioneer_get_safe_title( $post_id )` function, after all tags and line breaks have been stripped. No further sanitization is applied here, so you can add HTML again.
|
||||
|
||||
**Parameters:**
|
||||
* $title (string) – The sanitized title of the post.
|
||||
* $post_id (int) – The post ID.
|
||||
* $context (string|null) - Context regarding where or how the title is used. Unsafe.
|
||||
* $args (array) - Optional additional arguments.
|
||||
|
||||
**Hooked Filters:**
|
||||
* `fictioneer_prefix_sticky_safe_title( $comments )` – Prepends icon to sticky blog posts.
|
||||
|
@ -174,7 +174,7 @@ if ( ! function_exists( 'fictioneer_api_get_story_node' ) ) {
|
||||
$chapter['prefix'] = $prefix;
|
||||
}
|
||||
|
||||
$chapter['title'] = fictioneer_get_safe_title( $chapter_id );
|
||||
$chapter['title'] = fictioneer_get_safe_title( $chapter_id, 'api-chapter' );
|
||||
|
||||
if ( ! empty( $group ) ) {
|
||||
$chapter['group'] = $group;
|
||||
|
@ -221,15 +221,17 @@ if ( ! function_exists( 'fictioneer_get_safe_title' ) ) {
|
||||
* Returns the sanitized title and accounts for empty strings
|
||||
*
|
||||
* @since 4.7.0
|
||||
* @since 5.12.0 - Added $context and $args parameters.
|
||||
* @link https://developer.wordpress.org/reference/functions/wp_strip_all_tags/
|
||||
*
|
||||
* @param int|WP_Post $post The post or post ID to get the title for.
|
||||
* @param boolean $no_filters Optional. Whether to ignore filters. Default false.
|
||||
* @param string|null $context Optional. Context regarding where and how the title is used.
|
||||
* @param array $args Optional. Additional parameters.
|
||||
*
|
||||
* @return string The title, never empty.
|
||||
*/
|
||||
|
||||
function fictioneer_get_safe_title( $post, $no_filters = false ) {
|
||||
function fictioneer_get_safe_title( $post, $context = null, $args = [] ) {
|
||||
// Setup
|
||||
$post_id = ( $post instanceof WP_Post ) ? $post->ID : $post;
|
||||
|
||||
@ -246,8 +248,8 @@ if ( ! function_exists( 'fictioneer_get_safe_title' ) ) {
|
||||
}
|
||||
|
||||
// Apply filters
|
||||
if ( ! $no_filters ) {
|
||||
$title = apply_filters( 'fictioneer_filter_safe_title', $title, $post_id );
|
||||
if ( ! ( $args['no_filters'] ?? 0 ) ) {
|
||||
$title = apply_filters( 'fictioneer_filter_safe_title', $title, $post_id, $context, $args );
|
||||
}
|
||||
|
||||
return $title;
|
||||
|
@ -381,7 +381,7 @@ if ( ! function_exists( 'fictioneer_add_epub_chapters' ) ) {
|
||||
}
|
||||
|
||||
// Setup
|
||||
$title = fictioneer_get_safe_title( $post->ID );
|
||||
$title = fictioneer_get_safe_title( $post->ID, 'epub-chapter' );
|
||||
$content = apply_filters( 'the_content', $post->post_content );
|
||||
$processed = false;
|
||||
$index++;
|
||||
|
@ -972,7 +972,7 @@ function fictioneer_callback_relationship_chapters( $selected, $meta_key, $args
|
||||
|
||||
// Build HTML
|
||||
foreach ( $selected as $chapter ) {
|
||||
$title = fictioneer_get_safe_title( $chapter );
|
||||
$title = fictioneer_get_safe_title( $chapter, 'admin-callback-relationship-chapters' );
|
||||
$classes = ['fictioneer-meta-field__relationships-item', 'fictioneer-meta-field__relationships-values-item'];
|
||||
|
||||
if ( get_post_meta( $chapter->ID, 'fictioneer_chapter_hidden', true ) ) {
|
||||
@ -1060,7 +1060,7 @@ function fictioneer_ajax_get_relationship_chapters( $post_id, $meta_key ) {
|
||||
// Build HTML for items
|
||||
foreach ( $query->posts as $chapter ) {
|
||||
// Chapter setup
|
||||
$title = fictioneer_get_safe_title( $chapter );
|
||||
$title = fictioneer_get_safe_title( $chapter, 'admin-ajax-get-relationship-chapters' );
|
||||
$classes = ['fictioneer-meta-field__relationships-item', 'fictioneer-meta-field__relationships-source-item'];
|
||||
|
||||
// Update title if necessary
|
||||
@ -1206,7 +1206,7 @@ function fictioneer_get_relationship_chapter_details( $chapter ) {
|
||||
function fictioneer_callback_relationship_story_pages( $selected, $meta_key, $args = [] ) {
|
||||
// Build HTML
|
||||
foreach ( $selected as $page ) {
|
||||
$title = fictioneer_get_safe_title( $page );
|
||||
$title = fictioneer_get_safe_title( $page, 'admin-callback-relationship-story-pages' );
|
||||
$classes = ['fictioneer-meta-field__relationships-item', 'fictioneer-meta-field__relationships-values-item'];
|
||||
|
||||
// Start HTML ---> ?>
|
||||
@ -1290,7 +1290,7 @@ function fictioneer_ajax_get_relationship_story_pages( $post_id, $meta_key ) {
|
||||
// Build HTML for items
|
||||
foreach ( $query->posts as $item ) {
|
||||
// Chapter setup
|
||||
$title = fictioneer_get_safe_title( $item );
|
||||
$title = fictioneer_get_safe_title( $item, 'admin-ajax-get-relationship-story-pages' );
|
||||
$classes = ['fictioneer-meta-field__relationships-item', 'fictioneer-meta-field__relationships-source-item'];
|
||||
|
||||
// Build and append item
|
||||
@ -1354,7 +1354,7 @@ function fictioneer_callback_relationship_collection( $selected, $meta_key, $arg
|
||||
|
||||
// Build HTML
|
||||
foreach ( $selected as $item ) {
|
||||
$title = fictioneer_get_safe_title( $item );
|
||||
$title = fictioneer_get_safe_title( $item, 'admin-callback-relationship-collection' );
|
||||
$label = esc_html( $post_type_labels[ $item->post_type ] ?? _x( '?', 'Relationship item label.', 'fictioneer' ) );
|
||||
$classes = ['fictioneer-meta-field__relationships-item', 'fictioneer-meta-field__relationships-values-item'];
|
||||
|
||||
@ -1453,7 +1453,7 @@ function fictioneer_ajax_get_relationship_collection( $post_id, $meta_key ) {
|
||||
// Build HTML for items
|
||||
foreach ( $query->posts as $item ) {
|
||||
// Chapter setup
|
||||
$title = fictioneer_get_safe_title( $item );
|
||||
$title = fictioneer_get_safe_title( $item, 'admin-ajax-get-relationship-collection' );
|
||||
$label = esc_html( $post_type_labels[ $item->post_type ] ?? _x( '?', 'Relationship item label.', 'fictioneer' ) );
|
||||
$classes = ['fictioneer-meta-field__relationships-item', 'fictioneer-meta-field__relationships-source-item'];
|
||||
|
||||
@ -1517,7 +1517,7 @@ function fictioneer_callback_relationship_featured( $selected, $meta_key, $args
|
||||
|
||||
// Build HTML
|
||||
foreach ( $selected as $item ) {
|
||||
$title = fictioneer_get_safe_title( $item );
|
||||
$title = fictioneer_get_safe_title( $item, 'admin-callback-relationship-featured' );
|
||||
$label = esc_html( $post_type_labels[ $item->post_type ] ?? _x( '?', 'Relationship item label.', 'fictioneer' ) );
|
||||
$classes = ['fictioneer-meta-field__relationships-item', 'fictioneer-meta-field__relationships-values-item'];
|
||||
|
||||
@ -1599,7 +1599,7 @@ function fictioneer_ajax_get_relationship_featured( $post_id, $meta_key ) {
|
||||
// Build HTML for items
|
||||
foreach ( $query->posts as $item ) {
|
||||
// Chapter setup
|
||||
$title = fictioneer_get_safe_title( $item );
|
||||
$title = fictioneer_get_safe_title( $item, 'admin-ajax-get-relationship-featured' );
|
||||
$label = esc_html( $post_type_labels[ $item->post_type ] ?? _x( '?', 'Relationship item label.', 'fictioneer' ) );
|
||||
$classes = ['fictioneer-meta-field__relationships-item', 'fictioneer-meta-field__relationships-source-item'];
|
||||
|
||||
@ -2626,11 +2626,11 @@ function fictioneer_render_chapter_data_metabox( $post ) {
|
||||
|
||||
$stories[ $story->ID ] = sprintf(
|
||||
_x( '%s (%s)', 'Chapter story meta field option with status label.', 'fictioneer' ),
|
||||
fictioneer_get_safe_title( $story->ID ),
|
||||
fictioneer_get_safe_title( $story->ID, 'admin-render-chapter-data-metabox-selectable-suffix' ),
|
||||
$status_label
|
||||
);
|
||||
} else {
|
||||
$stories[ $story->ID ] = fictioneer_get_safe_title( $story->ID );
|
||||
$stories[ $story->ID ] = fictioneer_get_safe_title( $story->ID, 'admin-render-chapter-data-metabox-selectable' );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2662,7 +2662,7 @@ function fictioneer_render_chapter_data_metabox( $post ) {
|
||||
|
||||
$stories[ $current_story_id ] = sprintf(
|
||||
_x( '%s %s', 'Chapter story meta field mismatched option with author and/or status label.', 'fictioneer' ),
|
||||
fictioneer_get_safe_title( $current_story_id ),
|
||||
fictioneer_get_safe_title( $current_story_id, 'admin-render-chapter-data-metabox-current-suffix' ),
|
||||
$suffix
|
||||
);
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ function fictioneer_log_story_chapter_changes( $story_id, $current, $previous, $
|
||||
_x( '#%s %s: %s.', 'Story changelog chapter added.', 'fictioneer' ),
|
||||
$post_id,
|
||||
$verb ? $verb : _x( 'added', 'Story changelog verb.', 'fictioneer' ),
|
||||
fictioneer_get_safe_title( $post_id )
|
||||
fictioneer_get_safe_title( $post_id, 'admin-log-added-story-chapter' )
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -230,7 +230,7 @@ function fictioneer_log_story_chapter_changes( $story_id, $current, $previous, $
|
||||
_x( '#%s %s: %s.', 'Story changelog chapter removed.', 'fictioneer' ),
|
||||
$post_id,
|
||||
$verb ? $verb : _x( 'removed', 'Story changelog verb.', 'fictioneer' ),
|
||||
fictioneer_get_safe_title( $post_id )
|
||||
fictioneer_get_safe_title( $post_id, 'admin-log-removed-story-chapter' )
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -280,7 +280,7 @@ function fictioneer_log_story_chapter_status_changes( $new_status, $old_status,
|
||||
sprintf(
|
||||
_x( '#%s privated: %s.', 'Story changelog chapter removed.', 'fictioneer' ),
|
||||
$post->ID,
|
||||
fictioneer_get_safe_title( $post->ID, true )
|
||||
fictioneer_get_safe_title( $post->ID, true, 'admin-log-status-change-publish_to_private' )
|
||||
)
|
||||
);
|
||||
|
||||
@ -294,7 +294,7 @@ function fictioneer_log_story_chapter_status_changes( $new_status, $old_status,
|
||||
sprintf(
|
||||
_x( '#%s unprivated: %s.', 'Story changelog chapter removed.', 'fictioneer' ),
|
||||
$post->ID,
|
||||
fictioneer_get_safe_title( $post->ID, true )
|
||||
fictioneer_get_safe_title( $post->ID, true, 'admin-log-status-change-private_to_publish' )
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -215,7 +215,7 @@ if ( ! function_exists( 'fictioneer_get_schema_node_article' ) ) {
|
||||
$article_node = array(
|
||||
'@type' => $type,
|
||||
'@id' => "#article",
|
||||
'headline' => fictioneer_get_safe_title( $post->ID ),
|
||||
'headline' => fictioneer_get_safe_title( $post->ID, 'seo-schema-article-node' ),
|
||||
'description' => $description,
|
||||
'url' => get_the_permalink( $post->ID ),
|
||||
'author' => array(
|
||||
|
@ -60,7 +60,7 @@ if ( ! function_exists( 'fictioneer_seo_fields' ) ) {
|
||||
|
||||
// Title
|
||||
$seo_title = $seo_fields['title'] ?? '';
|
||||
$seo_title_placeholder = fictioneer_get_safe_title( $post->ID );
|
||||
$seo_title_placeholder = fictioneer_get_safe_title( $post->ID, 'seo-title-placeholder' );
|
||||
|
||||
// Description (truncated if necessary)
|
||||
$seo_description = $seo_fields['description'] ?? '';
|
||||
@ -334,7 +334,7 @@ if ( ! function_exists( 'fictioneer_get_seo_title' ) ) {
|
||||
$seo_fields = get_post_meta( $post_id, 'fictioneer_seo_fields', true );
|
||||
$seo_fields = is_array( $seo_fields ) ? $seo_fields : array( 'title' => '', 'description' => '', 'og_image_id' => 0 );
|
||||
$seo_title = $seo_fields['title'] ?? '';
|
||||
$title = fictioneer_get_safe_title( $post_id );
|
||||
$title = fictioneer_get_safe_title( $post_id, 'seo-title' );
|
||||
$default = empty( $default ) ? $title : $default;
|
||||
|
||||
// Special Case: Frontpage
|
||||
@ -501,7 +501,7 @@ if ( ! function_exists( 'fictioneer_get_seo_description' ) ) {
|
||||
$seo_fields = get_post_meta( $post_id, 'fictioneer_seo_fields', true );
|
||||
$seo_fields = is_array( $seo_fields ) ? $seo_fields : array( 'title' => '', 'description' => '', 'og_image_id' => 0 );
|
||||
$seo_description = $seo_fields['description'] ?? '';
|
||||
$title = fictioneer_get_safe_title( $post_id );
|
||||
$title = fictioneer_get_safe_title( $post_id, 'seo-title-in_description' );
|
||||
$excerpt = wp_strip_all_tags( get_the_excerpt( $post_id ), true );
|
||||
$excerpt = fictioneer_truncate( $excerpt, 155 );
|
||||
$default = empty( $default ) ? $excerpt : $default;
|
||||
|
@ -1012,7 +1012,7 @@ function fictioneer_shortcode_chapter_list( $attr ) {
|
||||
$icon = fictioneer_get_icon_field( 'fictioneer_chapter_icon', $chapter_id );
|
||||
$text_icon = get_post_meta( $chapter_id, 'fictioneer_chapter_text_icon', true );
|
||||
$prefix = get_post_meta( $chapter_id, 'fictioneer_chapter_prefix', true );
|
||||
$title = fictioneer_get_safe_title( $chapter_id );
|
||||
$title = fictioneer_get_safe_title( $chapter_id, 'shortcode-chapter-list' );
|
||||
$has_password = ! empty( $post->post_password );
|
||||
|
||||
// Start HTML ---> ?>
|
||||
|
@ -380,7 +380,7 @@ if ( ! function_exists( 'fictioneer_get_story_data' ) ) {
|
||||
'fandoms' => $fandoms,
|
||||
'warnings' => $warnings,
|
||||
'genres' => $genres,
|
||||
'title' => fictioneer_get_safe_title( $story_id ),
|
||||
'title' => fictioneer_get_safe_title( $story_id, 'utility-get-story-data' ),
|
||||
'rating' => get_post_meta( $story_id, 'fictioneer_story_rating', true ),
|
||||
'rating_letter' => get_post_meta( $story_id, 'fictioneer_story_rating', true )[0],
|
||||
'chapter_ids' => $visible_chapter_ids,
|
||||
|
@ -362,7 +362,7 @@ if ( ! function_exists( 'fictioneer_comment_notification' ) ) {
|
||||
array(
|
||||
'[[post_id]]' => $parent->comment_post_ID,
|
||||
'[[post_url]]' => get_permalink( $parent->comment_post_ID ),
|
||||
'[[post_title]]' => fictioneer_get_safe_title( $parent->comment_post_ID ),
|
||||
'[[post_title]]' => fictioneer_get_safe_title( $parent->comment_post_ID, 'comment-notification' ),
|
||||
'[[comment_id]]' => $parent->comment_ID,
|
||||
'[[comment_name]]' => $comment_author,
|
||||
'[[comment_excerpt]]' => get_comment_excerpt( $parent->comment_ID ),
|
||||
|
@ -566,7 +566,7 @@ function fictioneer_story_chapters( $args ) {
|
||||
'icon' => fictioneer_get_icon_field( 'fictioneer_chapter_icon', $chapter_id ),
|
||||
'text_icon' => get_post_meta( $chapter_id, 'fictioneer_chapter_text_icon', true ),
|
||||
'prefix' => get_post_meta( $chapter_id, 'fictioneer_chapter_prefix', true ),
|
||||
'title' => fictioneer_get_safe_title( $chapter_id ),
|
||||
'title' => fictioneer_get_safe_title( $chapter_id, 'story-chapter-list' ),
|
||||
'list_title' => get_post_meta( $chapter_id, 'fictioneer_chapter_list_title', true ),
|
||||
'words' => fictioneer_get_word_count( $chapter_id ),
|
||||
'warning' => get_post_meta( $chapter_id, 'fictioneer_chapter_warning', true )
|
||||
|
@ -127,7 +127,7 @@ if ( ! function_exists( 'fictioneer_build_story_schema' ) ) {
|
||||
'name' => _x( 'Chapters', 'SEO schema story chapters list node name.', 'fictioneer' ),
|
||||
'description' => sprintf(
|
||||
_x( 'Chapters of %s.', 'SEO schema story chapters list node description.', 'fictioneer' ),
|
||||
fictioneer_get_safe_title( $post_id )
|
||||
fictioneer_get_safe_title( $post_id, 'seo-schema-story-chapter-list-node' )
|
||||
),
|
||||
'mainEntityOfPage' => ['@id' => '#article'],
|
||||
'itemListElement' => []
|
||||
|
@ -117,7 +117,7 @@ function fictioneer_log_post_update( $post_id, $action ) {
|
||||
$post_type_name,
|
||||
$post_id,
|
||||
$action,
|
||||
fictioneer_get_safe_title( $post_id )
|
||||
fictioneer_get_safe_title( $post_id, 'admin-log-post-update' )
|
||||
);
|
||||
|
||||
// Log
|
||||
|
@ -331,9 +331,9 @@ function fictioneer_ajax_get_follows_notifications() {
|
||||
<div class="follow-item <?php echo $new; ?>" data-chapter-id="<?php echo $chapter->ID; ?>" data-story-id="<?php echo $story_id; ?>" data-timestamp="<?php echo $chapter_timestamp; ?>">
|
||||
<div class="follow-wrapper">
|
||||
<div class="follow-title truncate _1-1">
|
||||
<a class="follow-title-link" href="<?php echo get_the_permalink( $chapter->ID ); ?>"><?php echo fictioneer_get_safe_title( $chapter->ID ); ?></a>
|
||||
<a class="follow-title-link" href="<?php echo get_the_permalink( $chapter->ID ); ?>"><?php echo fictioneer_get_safe_title( $chapter->ID, 'ajax-get-follows-notifications' ); ?></a>
|
||||
</div>
|
||||
<div class="follow-meta truncate _1-1"><?php echo $date ; ?> in <?php echo fictioneer_get_safe_title( $story_id ); ?></div>
|
||||
<div class="follow-meta truncate _1-1"><?php echo $date ; ?> in <?php echo fictioneer_get_safe_title( $story_id, 'ajax-get-follows-notifications' ); ?></div>
|
||||
<div class="follow-marker">•</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -124,7 +124,7 @@ $pag_args = array(
|
||||
|
||||
// Setup
|
||||
$story_id = ( $post->post_type === 'fcn_story' ) ? $post->ID : null;
|
||||
$title = fictioneer_get_safe_title( $post->ID );
|
||||
$title = fictioneer_get_safe_title( $post->ID, 'card-article' );
|
||||
$permalink = get_permalink();
|
||||
$categories = wp_get_post_categories( $post->ID );
|
||||
$tags = get_the_tags();
|
||||
|
@ -20,7 +20,7 @@
|
||||
defined( 'ABSPATH' ) OR exit;
|
||||
|
||||
// Setup
|
||||
$title = fictioneer_get_safe_title( $post->ID );
|
||||
$title = fictioneer_get_safe_title( $post->ID, 'card-chapter' );
|
||||
$story_id = get_post_meta( $post->ID, 'fictioneer_chapter_story', true );
|
||||
$story_post = get_post( $story_id );
|
||||
$story_unpublished = get_post_status( $story_id ) !== 'publish';
|
||||
|
@ -20,7 +20,7 @@ defined( 'ABSPATH' ) OR exit;
|
||||
|
||||
// Setup
|
||||
$list_title = trim( get_post_meta( $post->ID, 'fictioneer_collection_list_title', true ) );
|
||||
$title = empty( $list_title ) ? fictioneer_get_safe_title( $post->ID ) : $list_title;
|
||||
$title = empty( $list_title ) ? fictioneer_get_safe_title( $post->ID, 'card-collection' ) : $list_title;
|
||||
$description = fictioneer_get_content_field( 'fictioneer_collection_description', $post->ID );
|
||||
$statistics = fictioneer_get_collection_statistics( $post->ID );
|
||||
$items = get_post_meta( $post->ID, 'fictioneer_collection_items', true );
|
||||
@ -139,7 +139,7 @@ if ( get_theme_mod( 'card_style', 'default' ) !== 'default' ) {
|
||||
if ( $list_title ) {
|
||||
echo wp_strip_all_tags( $list_title );
|
||||
} else {
|
||||
echo fictioneer_get_safe_title( $item->ID );
|
||||
echo fictioneer_get_safe_title( $item->ID, 'card-collection-list' );
|
||||
}
|
||||
?></a>
|
||||
</div>
|
||||
|
@ -17,7 +17,7 @@
|
||||
defined( 'ABSPATH' ) OR exit;
|
||||
|
||||
// Setup
|
||||
$title = fictioneer_get_safe_title( $post->ID );
|
||||
$title = fictioneer_get_safe_title( $post->ID, 'card-page' );
|
||||
$comments_number = get_comments_number();
|
||||
$card_classes = [];
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
defined( 'ABSPATH' ) OR exit;
|
||||
|
||||
// Setup
|
||||
$title = fictioneer_get_safe_title( $post->ID );
|
||||
$title = fictioneer_get_safe_title( $post->ID, 'card-post' );
|
||||
$tags = get_the_tags();
|
||||
$categories = wp_get_post_categories( $post->ID );
|
||||
$card_classes = [];
|
||||
|
@ -19,7 +19,7 @@
|
||||
defined( 'ABSPATH' ) OR exit;
|
||||
|
||||
// Setup
|
||||
$title = fictioneer_get_safe_title( $post->ID );
|
||||
$title = fictioneer_get_safe_title( $post->ID, 'card-recommendation' );
|
||||
$links = array_merge(
|
||||
fictioneer_url_list_to_array( get_post_meta( $post->ID, 'fictioneer_recommendation_urls', true ) ),
|
||||
fictioneer_url_list_to_array( get_post_meta( $post->ID, 'fictioneer_recommendation_support', true ) )
|
||||
|
@ -137,7 +137,7 @@ if ( get_theme_mod( 'card_style', 'default' ) !== 'default' ) {
|
||||
$list_title = trim( wp_strip_all_tags( $list_title ) );
|
||||
|
||||
if ( empty( $list_title ) ) {
|
||||
$chapter_title = fictioneer_get_safe_title( $chapter->ID );
|
||||
$chapter_title = fictioneer_get_safe_title( $chapter->ID, 'card-story-chapter-list' );
|
||||
} else {
|
||||
$chapter_title = $list_title;
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
continue;
|
||||
}
|
||||
|
||||
$title = fictioneer_get_safe_title( $post->ID );
|
||||
$title = fictioneer_get_safe_title( $post->ID, 'shortcode-latest-chapters-compact' );
|
||||
$story = $story_id ? fictioneer_get_story_data( $story_id, false ) : null; // Does not refresh comment count!
|
||||
$text_icon = get_post_meta( $post->ID, 'fictioneer_chapter_text_icon', true );
|
||||
$card_classes = [];
|
||||
@ -194,7 +194,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
printf(
|
||||
_x( 'in <a href="%1$s" class="bold-link">%2$s</a>', 'Small card: in {Link to Story}.', 'fictioneer' ),
|
||||
get_permalink( $story_id ),
|
||||
fictioneer_truncate( fictioneer_get_safe_title( $story_id ), 24 )
|
||||
fictioneer_truncate( fictioneer_get_safe_title( $story_id, 'shortcode-latest-chapters-compact' ), 24 )
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
@ -127,7 +127,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
continue;
|
||||
}
|
||||
|
||||
$title = fictioneer_get_safe_title( $post->ID );
|
||||
$title = fictioneer_get_safe_title( $post->ID, 'shortcode-latest-chapters' );
|
||||
$chapter_rating = get_post_meta( $post->ID, 'fictioneer_chapter_rating', true );
|
||||
$story = $story_id ? fictioneer_get_story_data( $story_id, false ) : null; // Does not refresh comment count!
|
||||
$text_icon = get_post_meta( $post->ID, 'fictioneer_chapter_text_icon', true );
|
||||
@ -194,7 +194,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
printf(
|
||||
_x( 'in <a href="%1$s" class="bold-link">%2$s</a>', 'Small card: in {Link to Story}.', 'fictioneer' ),
|
||||
get_permalink( $story_id ),
|
||||
fictioneer_truncate( fictioneer_get_safe_title( $story_id ), 24 )
|
||||
fictioneer_truncate( fictioneer_get_safe_title( $story_id, 'shortcode-latest-chapters' ), 24 )
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
|
||||
<?php
|
||||
// Setup
|
||||
$title = fictioneer_get_safe_title( $post->ID );
|
||||
$title = fictioneer_get_safe_title( $post->ID, 'shortcode-latest-posts' );
|
||||
$label = esc_attr( sprintf( _x( 'Continue reading %s', 'Read more link aria label', 'fictioneer' ), $title ) );
|
||||
|
||||
if (
|
||||
|
@ -99,7 +99,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
|
||||
<?php
|
||||
// Setup
|
||||
$title = fictioneer_get_safe_title( $post->ID );
|
||||
$title = fictioneer_get_safe_title( $post->ID, 'shortcode-latest-recommendations-compact' );
|
||||
$one_sentence = get_post_meta( $post->ID, 'fictioneer_recommendation_one_sentence', true );
|
||||
$fandoms = get_the_terms( $post, 'fcn_fandom' );
|
||||
$characters = get_the_terms( $post, 'fcn_character' );
|
||||
|
@ -100,7 +100,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
|
||||
<?php
|
||||
// Setup
|
||||
$title = fictioneer_get_safe_title( $post->ID );
|
||||
$title = fictioneer_get_safe_title( $post->ID, 'shortcode-latest-recommendations' );
|
||||
$one_sentence = get_post_meta( $post->ID, 'fictioneer_recommendation_one_sentence', true );
|
||||
$fandoms = get_the_terms( $post, 'fcn_fandom' );
|
||||
$characters = get_the_terms( $post, 'fcn_character' );
|
||||
|
@ -216,7 +216,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
$list_title = trim( wp_strip_all_tags( $list_title ) );
|
||||
|
||||
if ( empty( $list_title ) ) {
|
||||
$chapter_title = fictioneer_get_safe_title( $chapter->ID );
|
||||
$chapter_title = fictioneer_get_safe_title( $chapter->ID, 'shortcode-latest-updates-compact' );
|
||||
} else {
|
||||
$chapter_title = $list_title;
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
$list_title = trim( wp_strip_all_tags( $list_title ) );
|
||||
|
||||
if ( empty( $list_title ) ) {
|
||||
$chapter_title = fictioneer_get_safe_title( $chapter->ID );
|
||||
$chapter_title = fictioneer_get_safe_title( $chapter->ID, 'shortcode-latest-updates' );
|
||||
} else {
|
||||
$chapter_title = $list_title;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ defined( 'ABSPATH' ) OR exit;
|
||||
|
||||
// Setup
|
||||
$post_id = get_the_ID();
|
||||
$title = fictioneer_get_safe_title( $post_id );
|
||||
$title = fictioneer_get_safe_title( $post_id, 'post' );
|
||||
$label = esc_attr( sprintf( _x( 'Continue reading %s', 'Read more link aria label', 'fictioneer' ), $title ) );
|
||||
$nested = $args['nested'] ?? false;
|
||||
|
||||
|
@ -123,7 +123,7 @@ remove_filter( 'posts_where', 'fictioneer_exclude_protected_posts' );
|
||||
|
||||
// Prepare titles
|
||||
$list_title = trim( wp_strip_all_tags( $list_title ) );
|
||||
$title = empty( $list_title ) ? fictioneer_get_safe_title( $post->ID ) : $list_title;
|
||||
$title = empty( $list_title ) ? fictioneer_get_safe_title( $post->ID, 'shortcode-showcase' ) : $list_title;
|
||||
|
||||
// Prepare image arguments
|
||||
$image_args = array(
|
||||
|
@ -43,7 +43,7 @@ get_header( null, $header_args );
|
||||
// Setup
|
||||
$chapter_ids = [];
|
||||
$password_class = ! empty( $post->post_password ) ? 'password' : '';
|
||||
$title = fictioneer_get_safe_title( $post->ID );
|
||||
$title = fictioneer_get_safe_title( $post->ID, 'single-chapter' );
|
||||
$age_rating = get_post_meta( $post->ID, 'fictioneer_chapter_rating', true );
|
||||
$this_breadcrumb = [ $title, get_the_permalink() ];
|
||||
|
||||
|
@ -35,7 +35,7 @@ get_header( null, array( 'type' => 'fcn_collection' ) );
|
||||
// Setup
|
||||
$featured_list = get_post_meta( $post->ID, 'fictioneer_collection_items', true );
|
||||
$featured_list = is_array( $featured_list ) ? $featured_list : [];
|
||||
$title = fictioneer_get_safe_title( $post->ID );
|
||||
$title = fictioneer_get_safe_title( $post->ID, 'single-collection' );
|
||||
$this_breadcrumb = [$title, get_the_permalink()];
|
||||
$current_page = max( 1, get_query_var( 'pg', 1 ) ?: 1 ); // Paged not available
|
||||
|
||||
|
@ -29,7 +29,7 @@ get_header( null, array( 'type' => 'fcn_recommendation' ) );
|
||||
|
||||
<?php
|
||||
// Setup
|
||||
$title = fictioneer_get_safe_title( $post->ID );
|
||||
$title = fictioneer_get_safe_title( $post->ID, 'single-recommendation' );
|
||||
$this_breadcrumb = [ $title, get_the_permalink() ];
|
||||
|
||||
// Arguments for hooks and templates/etc.
|
||||
|
@ -26,7 +26,7 @@ get_header();
|
||||
|
||||
<?php
|
||||
// Setup
|
||||
$title = fictioneer_get_safe_title( $post->ID );
|
||||
$title = fictioneer_get_safe_title( $post->ID, 'single-post' );
|
||||
$this_breadcrumb = [ $title, get_the_permalink() ];
|
||||
?>
|
||||
|
||||
|
@ -30,7 +30,7 @@ get_header();
|
||||
|
||||
<?php
|
||||
// Setup
|
||||
$title = fictioneer_get_safe_title( $post_id );
|
||||
$title = fictioneer_get_safe_title( $post_id, 'singular-titleless' );
|
||||
$this_breadcrumb = [ $title, get_the_permalink() ];
|
||||
?>
|
||||
|
||||
|
@ -30,7 +30,7 @@ get_header();
|
||||
|
||||
<?php
|
||||
// Setup
|
||||
$title = fictioneer_get_safe_title( $post_id );
|
||||
$title = fictioneer_get_safe_title( $post_id, 'singular' );
|
||||
$this_breadcrumb = [$title, get_the_permalink()];
|
||||
?>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user