• Resolved sergiosala

    (@sergiosala)


    Can I insert via php or shortcode especifically to a blog post? Which code should I use?

    • This topic was modified 8 years, 9 months ago by sergiosala.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Steven

    (@shazahm1hotmailcom)

    @sergiosala

    You can already do this… Disable the “Auto Insert” for the desired post types on the Settings : Table of Contents admin page.

    When adding a new page or post enable the “Insert table of contents.” option on that page/post.

    Hope that helps, let me know.

    Thread Starter sergiosala

    (@sergiosala)

    Ok, but what I want is to add the Table of content in the sidebar automatically, every time a user choose a template. In this template I want to add the TOC via php. How can I do it?

    Steven

    (@shazahm1hotmailcom)

    @sergiosala

    I see…

    Probably the easiest solution is to hook into the save_post_{$type} filter check for the chosen template and set the post meta _ez-toc-insert key to true. There is no function available in PHP where you can just add to a template file to output the TOC because that occurs within coree WP filters based on the post meta and/plugin setting values.

    Hope this helps!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Insert via php’ is closed to new replies.