WordPress.org

Ready to get started?Download WordPress

Forums

TinyMCE Advanced
[resolved] Retain Microdata Code Toggling Between Views (5 posts)

  1. nickienicole
    Member
    Posted 1 year ago #

    I need to add Schema.org microdata to multiple locations pages for a client's site.

    In HTML view I can enter:
    <div itemprop="name">Name</div>

    However, when I update, then toggle to Visual view, and update again, it strips out all microdata code to just <div> or <span>.

    I know there are multiple plugins available for adding microdata, but none of them do exactly what I want, so those are not solutions for me.

    I saw this post here, that would probably do the trick to add "extended_valid_elements"; however, I do not know where to place that code, since I do not have backend access to those files. Also, I'm pretty sure any changes to the code would get overwritten if the client ran an update anyway.

    We do have TinyMCE Advanced plugin installed, but I'm not sure if I can implement a solution using it. Does anyone have any ideas? I've spent hours searching on the web to try to fix this, including extensive research on WordPress forums, and I've come up with nothing.

    Any help is much appreciated!

    http://wordpress.org/extend/plugins/tinymce-advanced/

  2. Andrew Ozz
    WordPress Dev
    Plugin Author

    Posted 1 year ago #

    Yes, you will need to "tell" TinyMCE about all new tag attributes. Extended_valid_elements is a good way to do that:
    http://www.tinymce.com/wiki.php/Configuration:extended_valid_elements. Alternatively, if you're only using DIVs, can add div[*] to allow any attr on this tag, but do read through TinyMCE's documentation to understand how that will affect the editor.

    To add custom settings to the TinyMCE init you would need something like http://wordpress.org/extend/plugins/advanced-tinymce-configuration/, or you can hard-code them in a small WordPress plugin.

  3. nickienicole
    Member
    Posted 1 year ago #

    Thank you, Andrew! I can't view the first link about configuration without signing up I guess. A couple questions, though, since I'm not too experienced with editing plugins. First: where to I place the extended_valid_elements code? And second: If I edit the plugin code, won't it overwrite my changes, if the client makes an update to that plugin?

  4. Andrew Ozz
    WordPress Dev
    Plugin Author

    Posted 1 year ago #

    Hmm, think the link has changed. Try through this page: http://www.tinymce.com/wiki.php/Configuration3x.

    To do this "manually" you'll need to make a custom WP plugin. It's not hard but you'll need to know some PHP and read through the codex on how plugins work. If you're not into this kind of things, use the plugin from the second link above :)

  5. nickienicole
    Member
    Posted 1 year ago #

    I finally solved this issue by creating a Custom Field and pasting the code exactly the way I wanted.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic