Skip to content

Commit

Permalink
If the heading contains a Hyphen then the headings will not work (Use…
Browse files Browse the repository at this point in the history
…r-specific) #774
  • Loading branch information
akshaywali committed Jul 1, 2024
1 parent 9dc2e23 commit 45b3f98
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions includes/inc.plugin-compatibility.php
Original file line number Diff line number Diff line change
Expand Up @@ -1163,4 +1163,28 @@ function ez_toc_store_original_post_id($post) {
if (class_exists('FusionBuilder') && false === get_transient('eztoc_original_post_id')) {
set_transient('eztoc_original_post_id', $post->ID);
}
}

/*
* Divi theme compatibility for removing soft hyphen and other hypens in the TOC heading title
* @since 2.0.69
*/
add_filter('ez_toc_content_heading_title', 'ez_toc_divi_heading_title_anchor',10,1);

function ez_toc_divi_heading_title_anchor($title){
if (function_exists('et_setup_theme')){
$title = preg_replace('/\x{00AD}/u', '', html_entity_decode($title , ENT_QUOTES, 'UTF-8')); // remove soft hyphen
$title = str_replace('','-',$title); // remove dash
}
return $title;
}

add_filter('ez_toc_url_anchor_target_before', 'ez_toc_divi_remove_soft_hypen_url',10,1);


function ez_toc_divi_remove_soft_hypen_url($anchor){
if (function_exists('et_setup_theme')){
$anchor = str_replace('','-',$anchor); // remove dash
}
return $anchor;
}

0 comments on commit 45b3f98

Please sign in to comment.