Hello,
Thank you for contacting Rank Math and bringing your concern to our attention.
Please try adding the following CSS code to your site:
.wp-block-rank-math-toc-block {
position:relative;
}
.wp-block-rank-math-toc-block h2 {
background: #f1f2f6;
padding: 10px 12px 10px 18px;
cursor: pointer;
font-size: 18px !important;
font-weight: normal !important;
position:relative;
margin-bottom: 0;
}
.wp-block-rank-math-toc-block h2:before {
display:inline-block;
content: "";
width: 0;
height: 0;
border-style: solid;
border-width: 6px 0 6px 12px;
border-color: transparent transparent transparent #000000;
margin-right: 8px;
}
.wp-block-rank-math-toc-block nav{
padding: 10px 10px 0px 10px;
max-height: 0;
overflow:hidden;
}
.wp-block-rank-math-toc-block input:checked+h2~nav {
max-height: 100vh;
overflow:visible;
}
Here’s a guide below on how you can add custom CSS on your site:
https://www.wpbeginner.com/plugins/how-to-easily-add-custom-css-to-your-wordpress-site/
Once done, add the following filter to your site: https://pastebin.com/i82VnJ3Z
Here’s how you can add filter/hook to your WordPress site:
https://rankmath.com/kb/wordpress-hooks-actions-filters/
Let us know how it goes. Looking forward to helping you.
Thank you.
Thanks! It’s working! 🙂
But I want to remove the icon (https://prnt.sc/JCfAKGZZXWp6) and want to show the table of content like this when toggle (https://prnt.sc/gHddtFIm6L2d) and when to collapse (https://prnt.sc/YrbE8o1313dE)
Hello,
You can remove the following CSS block
.wp-block-rank-math-toc-block h2:before {
display:inline-block;
content: "";
width: 0;
height: 0;
border-style: solid;
border-width: 6px 0 6px 12px;
border-color: transparent transparent transparent #000000;
margin-right: 8px;
}
And add the following CSS block:
.wp-block-rank-math-toc-block h2:after {
display:inline-block;
font-size:12px;
content: '[show]';
}
You may remove/adjust the font size to your preferred size.
Hope that helps. Please let us know if you have questions.
Hello,
Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.
If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.
Thank you.