• Hi! I have a layout on my site where I would like the table of contents to appear before the first H3 tag. None of the solutions provided in the plugin settings offer this option. I know it can be done manually, but it’s too much work for over 1,000 posts. I’ve tried using a function, but unfortunately, it doesn’t work. Is it possible to automatically place the table of contents in the location I specified, i.e., before the H3 tag? Here is the function:

    function custom_insert_toc_before_h3($content) {
    if (is_singular() && function_exists('boomdevs_toc')) {
    $h3_position = strpos($content, '<h3');
    if ($h3_position !== false) {
    $before_h3 = substr($content, 0, $h3_position);
    $after_h3 = substr($content, $h3_position);

    $content = $before_h3 . boomdevs_toc() . $after_h3;
    }
    }
    return $content;
    }
    add_filter('the_content', 'custom_insert_toc_before_h3');
Viewing 1 replies (of 1 total)
  • Plugin Author WP Messiah

    (@wpmessiah)

    Hello Sir,

    Thank you for reaching out to us! To achieve your desired result, you can use our plugin’s shortcode [boomdevs_toc]. By placing this shortcode directly in the content or template where you’d like the Table of Contents to appear, you can meet your specific requirements with ease.

    For even better support, we kindly suggest creating a topic in our official support forum. This allows us to provide you with more detailed assistance tailored to your needs.

    Best, BoomDevs

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.