Bump to 1.4.0, made some fixes for 8.2+

This commit is contained in:
2025-05-11 16:58:27 -07:00
parent 75cbf48af8
commit 5fd30040a4
14 changed files with 428 additions and 439 deletions

View File

@ -197,3 +197,40 @@ require get_template_directory() . '/inc/metaboxes/mt-post-sidebar-meta.php';
if ( ! function_exists( 'breadcrumb_trail' ) ) {
require get_template_directory() . '/inc/mt-class-breadcrumbs.php';
}
// Function to allow images in WordPress comments
function allow_images_in_comments($comment_content) {
// Allow only specific HTML tags, including <img>
$allowed_tags = array(
'a' => array('href' => array(), 'title' => array()),
'em' => array(),
'strong' => array(),
'img' => array(
'src' => array(),
'alt' => array(),
'width' => array(),
'height' => array(),
'class' => array(),
),
);
// Strip out disallowed tags but keep allowed ones
return wp_kses($comment_content, $allowed_tags);
}
// Hook to filter the comment text before displaying it
add_filter('comment_text', 'allow_images_in_comments');
// Function to make URLs for images clickable in comments
function clickable_images_in_comments($comment_content) {
// Automatically convert image URLs to HTML <img> tags
$comment_content = preg_replace(
'/(http:\/\/[^\s"]+\.(jpg|jpeg|png|gif))/i',
'<img src="$1" alt="" class="comment-image" />',
$comment_content
);
return $comment_content;
}
// Hook to make image URLs clickable
add_filter('comment_text', 'clickable_images_in_comments');