Tavarez: Guimares, i have written my own widget
Tavarez: I want to be able to place the widget using a shortcode
Chapp: Afmza: ok. but where does the shortcode come in? Thats what i
Tichnell: Afmza: you just need to take your widget output code and make it into a shortcode as well.
Figarsky: Afmza: well. it depends on what your widget does TBH. Does your widget have configuration options?
Sachez: Afmza: did you look at my plugin?
Tavarez: The output is in the widget extension cl***
Sachez: Back. needed to clear several months of discussion logs :-
Tavarez: Okay, so do i need to make a copy of the output from the widget extension cl***?
Northcote: Sachez: that just makes shortcodes. not shortcodes from widgets
Sachez: He asked how you make shortcodes in a plug
Granato: Sachez: from a widget
Dorich: The output is from a widget he made
Bomia: Afmza: you have to remake the function because the widget specific function that makes the output is also based on instances of the widgets meaning when you drag more than one version of the same widget into the sidebar
Tavarez: There is no way to refrence the existing widget output? seems horrible that i have to duplicate code :
Shifrin: Afmza: so you make your output code unique for your shortcode but you can use ant variables you might need / have used across the cl***. although I dont think you would have any
Eberspacher: Afmza: no because the output code is based on instances of the widgets as well. i believe
Lymaster: Afmza: you MIGHT be able to get the output of a widget by forcing an instance of it
Tavarez: Im also using js and css files in my widget
Maine: Afmza: the_widget your_widget_cl***_name, $instance, $args ;
Renda: Afmza: including those would depend on how your loading those
Buszak: Afmza: ok here you go http://www.smashingmagazine.com/2012/12/inserting-widgets-with-shortcodes/
Tullison: Afmza: the problem is that article does not seem to touch on what to do with forcing the instance
Mendes: Afmza: what is the reason you need to do this with a shortcode?
Cantos: Sachez: about define ‘DB_COLLATE’ setting in wp-config.php, does change/force Benzing, all will be done on server level so I have changed settings in /etc/my.cnf and whoalla. works flawless and WP just obey :
Tavarez: Guimares, i want to be able to put the widget on pages.
Manganiello: Afmza: sidebars are for putting widgets on pages. so you should use the normal widget code and sidebars for that. You can even install a “conditional widget” plugin where you can tell it to only display on a specific page.
Stowell: Afmza: as for inside of the post content. what exactly does your widget do?
Tavarez: Guimares, its a calculator
Tavarez: Single page application
Tavarez: Doesnt really fit on a side panel
Tavarez: So i probably should have made it a widget
Lajza: Afmza: then why make it a widget at al?
Tavarez: Guimares, im not very familiar with wordpress 😛
Kehm: Afmza: just make it a shortcode or, better yet, a custom metabox that lets people check off of they want it on the page or not
Geraghty: Afmza: thats why data architecture is important. Knowing what data models to use and when
Tavarez: I learn as i go along.
Emfinger: Afmza: i would remake it as either a shortcode only OR a metabox
Tavarez: Okay, shortcode is cool
Tavarez: U got a URL for that?
Bowser: Afmza: thats fine and wlel if you’re willing to rework when you find a better way instead of shoehorning
Tavarez: Its probably easier, since i dont have to worry about instances etc.