Prefix titles of sticky blog posts with icon
This commit is contained in:
parent
be8f2b19e2
commit
5219412710
@ -301,6 +301,7 @@ Fictioneer customizes WordPress by using as many standard action and filter hook
|
||||
| `show_admin_bar` | `__return_false`
|
||||
| `the_content` | `fictioneer_embed_consent_wrappers`, `fictioneer_add_lightbox_to_post_images`, `fictioneer_add_chapter_paragraph_id`
|
||||
| `the_password_form` | `fictioneer_password_form`
|
||||
| `the_title` | `fictioneer_prefix_sticky_title`
|
||||
| `theme_templates` | `fictioneer_disallow_page_template_select`
|
||||
| `update_post_metadata` | `fictioneer_prevent_page_template_update`
|
||||
| `upload_size_limit` | `fictioneer_upload_size_limit`
|
||||
@ -309,7 +310,7 @@ Fictioneer customizes WordPress by using as many standard action and filter hook
|
||||
| `user_has_cap` | `fictioneer_edit_only_comments`
|
||||
| `wp_list_comments_args` | `fictioneer_comment_list_args`
|
||||
| `wp_handle_upload_prefilter` | `fictioneer_upload_restrictions`
|
||||
| `wp_insert_post_data` | `fictioneer_remove_restricted_block_content`, `fictioneer_strip_shortcodes_on_save`, `fictioneer_see_some_evil`, `fictioneer_enforce_permalink`, `fictioneer_prevent_publish_date_update`, `fictioneer_prevent_parent_and_order_update`
|
||||
| `wp_insert_post_data` | `fictioneer_remove_restricted_block_content`, `fictioneer_strip_shortcodes_on_save`, `fictioneer_see_some_evil`, `fictioneer_enforce_permalink`, `fictioneer_prevent_publish_date_update`, `fictioneer_prevent_parent_and_order_update`, `fictioneer_prevent_track_and_ping_updates`
|
||||
| `wp_is_application_passwords_available` | `__return_false`
|
||||
| `wp_robots` | `fictioneer_add_noindex_to_robots`
|
||||
| `wp_sitemaps_enabled` | `__return_false`
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1156,6 +1156,8 @@ add_action( 'template_redirect', 'fictioneer_gate_unpublished_content' );
|
||||
/**
|
||||
* Prevents trackback/pingback from being updated
|
||||
*
|
||||
* @since Fictioneer 5.7.0
|
||||
*
|
||||
* @param array $data An array of slashed, sanitized, and processed post data.
|
||||
*
|
||||
* @return array The modified post data.
|
||||
@ -1172,4 +1174,30 @@ function fictioneer_prevent_track_and_ping_updates( $data ) {
|
||||
}
|
||||
add_filter( 'wp_insert_post_data', 'fictioneer_prevent_track_and_ping_updates', 1 );
|
||||
|
||||
// =============================================================================
|
||||
// ADD STICKY PREFIX TO STICKY BLOG POSTS
|
||||
// =============================================================================
|
||||
|
||||
/**
|
||||
* Prepends icon to titles of sticky posts
|
||||
*
|
||||
* @since Fictioneer 5.7.1
|
||||
*
|
||||
* @param string $title The original title of the post.
|
||||
* @param int $id The ID of the post.
|
||||
*
|
||||
* @return string The modified title.
|
||||
*/
|
||||
|
||||
function fictioneer_prefix_sticky_title( $title, $id ) {
|
||||
// Prepend icon to titles of sticky posts
|
||||
if ( is_sticky( $id ) ) {
|
||||
return '<i class="fa-solid fa-thumbtack sticky-pin"></i> ' . $title;
|
||||
}
|
||||
|
||||
// Continue filter
|
||||
return $title;
|
||||
}
|
||||
add_filter( 'the_title', 'fictioneer_prefix_sticky_title', 10, 2 );
|
||||
|
||||
?>
|
||||
|
@ -40,6 +40,11 @@
|
||||
margin-bottom: 0; // Override if inside content-section
|
||||
}
|
||||
|
||||
&__title .sticky-pin {
|
||||
font-size: 0.85em;
|
||||
margin-right: 0.125em;
|
||||
}
|
||||
|
||||
&__meta {
|
||||
display: flex;
|
||||
gap: .5rem 1.5rem;
|
||||
|
Loading…
x
Reference in New Issue
Block a user