0

I've been working on creating my first homebrew plugin for our site, and I'm so daggone proud of what I've been able to do so far. The plugin is called by a shortcode - in the plugin, I've successfully connected to our FileMaker cloud database and retrieved values from a record using that API. I've also succesfully decoded the JSON that comes back from the GET request, and busted out all the values in to variables within the plugin.

...pats myself on my amateur developer back....

Okay, so in the plugin I've got about 12 variables that get their value from the corresponding table in FileMaker (e.g. $name $weight $date_modified $status).

Now here's the question - what's the best way to display those values on the page that has the associated shortcode?

I've played around with using echo in the plugin, and that kicks back the variable - but is there a good way to be able to display the variable values using formatting provided by my site's theme? Is it good form (or even possible) to use theme shortcodes inside my own plugin?

  • Do you mean you wana use custom shortcodes in your php templates? =/ – Patrick Aug 5 '18 at 23:36
  • Best way to handle a JSON response obtained by a GET request is to call the resource via ajax and process the result with jQuery/javascript codex.wordpress.org/AJAX_in_Plugins – Andrea Somovigo Aug 6 '18 at 7:54
  • Thanks for responding - I've got the JSON response handled. It's decoded within the plugin, and the data is assigned to variables. Is there a way to "carry" those variables back to the front end editor so I can use those variables in other shortcodes provided by my site theme? Or would it be better to handle the display of the variables in the shortcode? – Hal Atkins Aug 7 '18 at 15:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.