Unable to Set Up Wordpress

Hi, I am new to Frontity and am unsure how to access the data from my Wordpress site.
I have followed the Getting Started instructions, replacing the default URL with my Wordpress websiteā€™s URL in frontity settings.
On the Wordpress site, I have a list of courses displayed in grid fashion which users can add to their cart. However, when I access the same route using Frontity (i.e. /courses route) I am unable to retrieve the coursesā€™ data (i.e. titles, prices, images) from the response (checking under the Developer tools console)

Am I missing something here? Any advice would be appreciated. Thanks!

Here is an image of the results I am getting:

Hello! I recommend following this tutorial as it helps you to access the state and set up your pages, posts etc and all the frontity tools you need to make that happen :sun_with_face: https://tutorial.frontity.org/

2 Likes

Thanks! I did just complete the tutorial though, but it doesnā€™t seem to translate when I try to apply it to my own project. I am able to access posts yes, but other data such as products I am somehow unable to access.

1 Like

Hi @cybersecma

Welcome to the Frontity community.

Iā€™m guessing that ā€˜coursesā€™ is a custom post type. See this part of the tutorial which addresses how to get CPTs using Frontity.

This part of the documentation goes into greater detail.

Hope this helps.

How do I differentiate a CPT from other types? I am new to WordPress as well and am not sure whether I am filling in the type, endpoint and archive correctly.

When I try to access /courses like the example shown (but with my website), I get ā€œmessageā€: ā€œNo route was found matching the URL and request method.ā€

Even for my contact-us page, I can see some semblance on the UI visually, but using the Developer Tools I canā€™t seem to access the contents.

Hi @cybersecma

Can you please provide a repo or code-sandbox with your code? This is especially helpful to find solutions to technical issues with specific code

Detailing the info suggested here when having issues will help the community to provide the best possible help as quickly and as efficiently as possible.

Also in your case, the endpoint of your REST API where your CPT are available will be helpful to help you with your issue

@cybersecma

In addition to the resources mentioned above we also have:

  • this repo which demonstrates the usage of CPTs in a Frontity project.
  • this video in our Frontity Talks series which also covers this subject.

If the endpoint doesnā€™t exist itā€™s possible that the plugin author has not added the CPT to the REST API. You can do this yourself by adding a code snippet. See here for more info.

Here you can check what are the default post types of WordPress. If itā€™s not in that list, then itā€™s probably a custom post type or a custom taxonomy.