• Resolved hassadr

    (@hassadr)


    Current Approach: I have attempted to use the following code in my theme’s functions.php file:

    <code> function disable_easy_toc_in_category($display) {
    if (is_single() && has_category('buying-guides')) {
    return false;
    }
    return $display;
    }
    add_filter('ez_toc_show', 'disable_easy_toc_in_category'); </code>

    Despite implementing this code, the TOC continues to display on posts within the specified category. I have also tried other methods without success.

    Could you please provide guidance or suggest a solution for ensuring the TOC does not appear on posts in the “buying-guides” category? If there are specific hooks or filters provided by the plugin that I should be using, or if there is another approach you recommend, I would greatly appreciate your advice.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Magazine3

    (@magazine3)

    Hi, thank you for reaching out to us. We have an option in our plugin that can help you achieve the desired output. Please refer to the manual once: How to Exclude TOC on the Same URL Path and follow all the steps outlined.

    It will work with multiple paths, but you have to press Enter in that box. Commas (‘,’) won’t work there. So, after every path, press Enter, and it will go below the path you have added. Then you can add the next path on which you don’t want to add a TOC. Check this screenshot for reference: Screenshot.

    Another way is using a shortcode. If you don’t want to display TOC on a specific post/page, use this shortcode: [no-ez-toc] on that page/post.

    Following these steps will help you achieve the desired output. Try this once and let us know if you need any help.

    • This reply was modified 3 months, 3 weeks ago by Magazine3.
    Thread Starter hassadr

    (@hassadr)

    Hi, Thank you for your reply.

    There is many links (more than 500 links).

    So, I need some auto-exclude using the Category slug. Like using a filter.

    Plugin Author Magazine3

    (@magazine3)

    Hi, We have received many requests for this feature, so we have already raised a ticket regarding it, and it will be addressed in our upcoming update. We kindly request your patience in the meantime.

    Here is the ticket: https://github.com/ahmedkaludi/Easy-Table-of-Contents/issues/631

    Until then, you can use the code you shared, but instead of “add_filter(‘ez_toc_show’, ‘disable_easy_toc_in_category’);” use this code: “add_filter(‘ez_toc_maybe_apply_the_content_filter’, ‘disable_easy_toc_in_category’);“.

    If you still have any questions, kindly let us know.

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