Does the TOC need to be a shortcode? Perhaps giving the editors a meta box with a set of radio boxes for none, below and above options would be cleaner?
You could then generate the TOC via the static variable approach you mentioned and output it during page render.
Related Posts:
- How to manually fix the WordPress gallery code using PHP in functions.php?
- Encode text string being appended as query to URL [closed]
- Display a text message if the shortcode is not found?
- How to return a string that has a variable inside in a shortcode?
- Run shortcode at certain resolution
- Passing a shortcode attribute to a sub-function
- post meta value as shortcode parameter
- How to protect own PHP code from WordPress updates
- Adding Image Count to Multigallery
- Loading page template into shortcode
- How to add Shortcode (font awesome) in widget title?
- Custom plugin issue when trying to use the shortcode twice on a page [closed]
- Nested shortCode functions in the functions.php file
- Placing the_content inside shortcode not working
- get_page_by_title with an apostrophe in variable
- Autogenerate shortcodes from an array of strings
- How to Insert Shortcodes into Theme?
- How can I get content inside one shortcode to another shortcode?
- is_page “range” for if statement?
- How can I generate random numbers inside my shortcodes on each implementation?
- Use WP_Query in shortcode
- Custom Theme, Custom shortcode not working
- Why is file_get_contents returning page source?
- Plugin CSS not enqueing
- Different loop output every x posts in custom post type
- Showing content from one page on another
- Showing a different gallery in a seperate post
- Create own WordPress shortcode gallery
- How to exclude category ID from Looper in WordPress
- Add a specific part of current category page url to shortcode
- Calculating a large number of MYSQL queries as customshort codes, slow
- WordPress Shortcodes.. printf is outputting a random number… Can’t figure out WHY?
- How to use wp_add_inline_style for custom CSS added via shortcode?
- How can I dynamically update the class in my shortcode?
- Displaying recent posts on static page with template-part via shortcode
- How to Reference/Echo Variable from Another PHP Function
- Replace shortcode in substring
- Get URL from shortcode tag
- Only first shortcode gets executed
- echo something inside a shortcode
- Shortcode from a function not working
- Display Data in Table from External Database in WP using Shortcodes
- Is it possible to return content, and then also continue to do other things?
- anyway to put inside a $outprint=sprintf()
- Creating WordPress Shortcode with Variable
- Catchable fatal error: Object of class stdClass could not be converted to string
- Capitalize Shortcode Value on Output
- Could use some help with Shortcodes
- Line breaks inside shortcode variable
- Shortcode for Listing Users from Meta Value?
- Shortcode to log user into current URL
- Shortcode function doesnt work without caption
- Shortcodes showing in excerpt despite using strip_shortcodes
- Calling PHP Titles inside Javascript Markup
- Create special button on WP Tiny MCE Posts Editor for Shortcodes
- How to get my [shortcode] rendered on the home page, other pages are fine
- Including Custom fields within the_content
- What is the difference between Null vs Empty (Zero Length) string?
- MySQL Query Returns Array () In Shortcode
- Show Featured Image Dimensions and size frontend with shortcode
- How to work Woocommerce pagination inside shortcode?
- How to get woocommerce orders with get_posts method in a shortcode
- Counting number of posts in multiple (sub)categories using shortcode
- Display Visual Composer shortcode if a post belongs in specific categories
- is it possible for a URL to filter by tag
- Trying to create a shortcode to display categories with a specific product tag
- How to pass parameters in wordpress shortcode?
- How can I prevent a shortcode div from extending beyond its boundaries?
- Adding variable in WordPress shortcode
- Display a custom name when the user has no name settle in his account
- Having trouble creating two shortcodes, one for logged in user and one for visitors
- Execute Shortcode in Textfile
- Echo short code syntax
- custom taxonomies not working
- How to return html as a string from php for WordPress
- Changing Date Format on Custom Meta Data w/shortcode call
- Reload page with a different shortcode when a user selects from a dropdown
- Add the shortcodes from the enfold theme to the other theme
- How to output values from a loop into a javascript array
- Offset with ajax load more posts duplicates
- Short code into PHP
- Add two or multiple functions in WordPress Post or Page
- Shortcode Works for Logged in Users but Not Working for Guest
- perform mathematical operation on shortcode
- Update same content in multiple posts at once?
- problem multisite with blog id
- Shortcode At top of Page – PHP 5.5 vs 5.4 – ob_start();
- Create dynamic content from one WP page to multiple other pages
- Shortcode Display From WordPress Dashboard Page Without Using post_id
- Do_shortcode on PHP file outside theme ALMOST works
- Using the same shortcode to show any table from the database
- Shortcoding with Divs
- Custom Shortcode with Dynamic Button
- Shortcode for Visual Composer Grid fails turning string to integer
- Is there a better way to output HTML as a shortcode?
- Gutenberg – render_callback does not pass ToggleControl value on frontend
- why css file not link?how to create permalink?
- How call WordPress shortcode inside function file
- Shortcode Displays 2 times
- “Joined in” or “Member since” displayed on single store page and then using shortcode to add