Skip Navigation

[Resolved] Displaying content returned from a custom plugin

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

This topic contains 3 replies, has 2 voices.

Last updated by Nigel 5 years, 1 month ago.

Assigned support staff: Nigel.

Author
Posts
#404714

I am relatively new to WP and Toolset. I have created a custom plugin that returns an array of adoptable pets with information such as age, sex, species and etc.

I want to be able to format the returned array in Toolset views by looping through the array. An example of this can be found on our current Concrete5 site hidden link

On our test site, I am formatting the content in the plugin and returning it for display using a shortcode. hidden link

If someone can point me in the right direction, it would be greatly appreciated.

#404795

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

The Toolset plugins work using the standard WordPress API and are built on standard content types stored using the standard WordPress database tables. It can't interact with other plugins that do anything different other than by bespoke code, which we are unable to write for you or support.

But. Can I get some more details from you so I can understand what you are trying to achieve and how Toolset can help?

- Where is this data coming from in the first place?
- How is it being entered in to your site?
- Have you already set up custom post types and custom fields for them (I'm guessing yes, that you have a pet custom post type and custom fields for animal, name, reference id, sex, breed, age etc...)
- What are the criteria for displaying the cats on the screen (I'm seeing all of them on your working site page, or a selection)?

The custom plugin you created, what is its purpose? To make an array of the cats available to other plugins, or does it do something else? If your data is already entered into your site in the form of custom posts with custom fields, the plugin to export the array sounds redundant in the context of Toolset, we can just work from your content to generate Views to display it how you want.

If you could elaborate and I'll give you some more specific advice.

#405450

Nigel,

The data is coming from Petpoint (hidden link). They have an API where I can get adoptable cats & dogs for the local humane society.

The results are returned as XML, and I am parsing the file to get the content that I want from it. (Picture, pet id, sex, age, breed,etc). I can either create an array with this information or format it in the plugin. Where I am running into issues, is I want the pets to be displayed in a grid so it's not just one big list.

I am not storing any of the information in a database table. Every time the page loads, it retrieves a response from the Petpoint API. This enables us to provide a real-time adoptable pet display.

I hope this makes sense.

Dave

#405462

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Dave

If you are pulling the data from the API each time and your plugin registers a shortcode for you to display the results then it seems like you are bypassing the WordPress database and not really using Toolset in any capacity to generate the content, so there's not much I can tell you I'm afraid.

I did have a quick poke under the hood and see that the original site appears to be using the Foundation CSS framework, but I'm not sure if your new site is trying to use Bootstrap or Foundation (or both).

I did spot an error in the browser which shows you are erroneously trying to load the foundation.css spreadsheet as if it were a JavaScript file (source line 99).

See this document about the correct way to add CSS and JS to your WordPress site: https://developer.wordpress.org/themes/basics/including-css-javascript/

Your shortcode which outputs the cat data will have to do so in such a way that it uses the HTML formatting and CSS classes required by your CSS framework of choice. See the Foundation and Bootstrap websites for more details.

The forum ‘Types Community Support’ is closed to new topics and replies.