Hi, we have checked on our end and found no such issues. It seems there may be a conflict on your side with the theme and plugins. Please check for any conflicts as this could be causing the problem.
Thread Starter
Adam
(@servicesportal)
I disabled all plugins and your plugin still scrolls up.
the thing is that the settings in the plugin do not work
I am finding the same thing as the topic starter. Thanks.
I am using the Kadence Theme. Could I ask which theme the opening poster is using?
Thread Starter
Adam
(@servicesportal)
woodmart i use.
But I don’t think the problem is with the theme, I installed this plugin on my other site, it works there. Both sites have the same plugins, the same theme, I made both sites.. So I don’t know why it doesn’t work.
-
This reply was modified 9 months, 1 week ago by
Adam.
Hi, could you please share a short video of the steps you’re taking and the issue that occurs afterward, so we can check?
Same issue here. How were you able to fix it?
I now set the IDs for each headline automatically via the functions.php:
function custom_sanitize_title($title)
{
$title = strtolower($title);
$umlauts = [
'ä' => 'ae',
'ö' => 'oe',
'ü' => 'ue',
'ß' => 'ss',
'Ä' => 'ae',
'Ö' => 'oe',
'Ü' => 'ue',
];
$title = strtr($title, $umlauts);
$title = preg_replace('/[^a-zA-Z0-9]+/', '-', $title);
$title = preg_replace('/-$/', '', $title);
return $title;
}
add_filter( 'the_content', 'add_ids_to_header_tags' );
function add_ids_to_header_tags( $content ) {
$pattern = '#(?P<full_tag><(?P<tag_name>h\d)(?P<tag_extra>[^>]*)>(?P<tag_contents>[^<]*)</h\d>)#i';
if ( preg_match_all( $pattern, $content, $matches, PREG_SET_ORDER ) ) {
$find = array();
$replace = array();
foreach( $matches as $match ) {
if ( strlen( $match['tag_extra'] ) && false !== stripos( $match['tag_extra'], 'id=' ) ) {
continue;
}
$find[] = $match['full_tag'];
$id = custom_sanitize_title( $match['tag_contents'] );
$id_attr = sprintf( ' id="%s"', $id );
$replace[] = sprintf( '<%1$s%2$s%3$s>%4$s</%1$s>', $match['tag_name'], $match['tag_extra'], $id_attr, $match['tag_contents']);
}
$content = str_replace( $find, $replace, $content );
}
return $content;
}
Hi @greller , could you please share the URL where you need assistance so we can take a look?
@akshaycode1 the page is not public yet. But for now my fix works fine. I assume it should usually generate the IDs automatically?