PhotoDune

WP Shortcode into TinyMCE (with several attrs?)

2148 posts
  • Author had a File in an Envato Bundle
  • Author had a Free File of the Month
  • Bought between 10 and 49 items
  • Exclusive Author
  • Germany
  • Has been a member for 3-4 years
  • Interviewed on the Envato Notes blog
+4 more
crozer says

Hey there,

so I’ve got this challenge: I want to incorporate a custom shortcode into the TinyMCE editor (visual editor). This is all very simple to achieve. However, what if the shortcode has several attributes?

Consider this example: [button color=blue type=round last=yes]My Button[/button].

Is it possible to do this? I have only done it with single-attribute shortcodes. Any hints/ideas would be greatly appreciated.

Thanks!
Chris ;)

1025 posts
  • Author had a File in an Envato Bundle
  • Bought between 50 and 99 items
  • Elite Author
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 500 and 999 users
  • Sold between 250 000 and 1 000 000 dollars
+1 more
ThemeBlvd says

Once you’ve figured out the initial part of actually doing the WordPress stuff to link up your little tinyMCE plugin, as you have, you’re not going to find a whole lot of WordPress specific tutorials out there online that expand on that. The reason is because now that you’ve set it up, it’s more of a question of “How do I create a tinyMCE plugin?” So, maybe it will be helpful now to start searching around for tutorials specifically about tinyMCE and going through their wiki. So, try eliminating “WordPress” from your searching, and you might be able to expand on the resources you’re finding. As far as giving the user choices for those different options and inserting those different options, that’s going to come with what you’re doing with the javascript of your tinyMCE plugin.

2148 posts
  • Author had a File in an Envato Bundle
  • Author had a Free File of the Month
  • Bought between 10 and 49 items
  • Exclusive Author
  • Germany
  • Has been a member for 3-4 years
  • Interviewed on the Envato Notes blog
+4 more
crozer says

Hey, thanks for the reply. But I am still wondering if anybody had already done this. I mean, I imagine all themes that offer tons of shortcodes (which are implemented in the visual editor) also have several attributes.

Either way, I’ll look for more TinyMCE-related threads. Thanks!
Chris

2507 posts Put a Donk On It
  • Attended a Community Meetup
  • Beta Tester
  • Bought between 10 and 49 items
  • Contributed a Tutorial to a Tuts+ Site
  • Elite Author
  • Exclusive Author
  • Has been a member for 3-4 years
  • Interviewed on the Envato Notes blog
+5 more
ThemeProvince says

Id suggest you buy a theme here and learn it or just create your own shortcode generator like me.

by
by
by
by
by